I need a little code to split a phrase/paragraph into sentences.
For example:
"My house is on fire. That should not be happening."
Is splitted into "My house is on fire." and "That should not be happening." and stored into separate strings.
Im still confused about the "set the begining of the next sentence to the first non-whitespace character". Could you please provide a little code example?
Here's a partial example. It shows some of the ideas needed.
1 2 3 4 5 6 7 8 9 10 11 12 13
string text = "My house is on fire! That should not be happening.";
size_t start = 0;
// look for end of sentence
size_t finish = text.find_first_of(".!?", start);
if (finish != string::npos)
{
// end of sentence was found, do something here.
// now find start of next sentence
start = text.find_first_not_of(" \t\n", finish+1);
}