1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
if (doc)
{
// while (!doc.eof())
//{
while (getline(doc,tmp))
{
istringstream stm(tmp);
string word;
while (stm>>word)
{
//stm>>word; // ignore the word already read ???
//tmp.erase (remove (tmp.begin(), tmp.end(), ' '), tmp.end());
//tmp.erase (remove (tmp.begin(), tmp.end(), ','), tmp.end());
word.erase (remove (word.begin(), word.end(), ','), word.end());
//tmp.erase (remove (tmp.begin(), tmp.end(), '.'), tmp.end());
word.erase (remove (word.begin(), word.end(), '.'), word.end());
//tmp.erase (remove (tmp.begin(), tmp.end(), '\''), tmp.end());
word.erase (remove (word.begin(), word.end(), '\''), word.end());
//b.insert(b.getRoot(),tmp);
if( !word.empty() ) b.insert(b.getRoot(),word);
cout<<"lin: "<<current_line_num<<" word: "<<word<<" ";
}
++ current_line_num;
}
//}
//doc.close();
//doc.clear();
//break;
}
|