You're not detecting the end of a sentence properly.
if(it1+1 == oneWordPhrase.end())
break; //signal break if we are near the end of a sentence
The line above will only be triggered when you reached the end of the entire phrase. Not just a sentence. To detect a sentence you'll need to detect the period. Here's one possible method:
for (it1 = oneWordPhrase.begin(); it1 + 1 != oneWordPhrase.end(); it1++) {
if (it1[0][(it1[0].size() - 1)] == '.') {
continue;
}
twoWordPhrase.push_back(*it1 + ' ' + *(it1 + 1));
}
I changed it1 != oneWordPhrase.end()
to it1 + 1 != oneWordPhrase.end()
to simulate the behavior of your break statement.
it1[0][(it1[0].size() - 1)]
Extracts the last char of the a word you stored.