Just a brief comment. The
while(buffer[sentence_end+1] ... etc.
that I mentioned isn't a serious problem, though it pushes at the boundaries. It can access a character past the end of the string, but that is usually containing a null terminator, and it will go no further because that clearly isn't the same as the end-of-sentence character.
As for the other problems, I suggest using a very simple program to test your code, trying to combine it with other classes and possibly complicated code may leave you uncertain as to which part is the cause of the problem
In my code for example, I did something like this:
1 2 3 4 5
|
std::ifstream fin("test.txt");
std::string buffer;
char ch;
while ( fin.get(ch) )
buffer += ch;
|
That rather crude code allowed me to load some text into the buffer in a simple and dependable way.
After that, any errors must arise from the sentence splitting code.
I also wrote the contents of the vector to an output file too, in order to evaluate the accuracy and validity of the results