// except for apostrophe, replace punctuation by a space // apostrophe is special: it might precede by 's, which is a suffix void TextQuery::strip_punct(string &line) { for (str_size pos = 0; pos != line.size(); ++pos) if (ispunct(line[pos])) { if (line[pos] != '\'') line[pos] = ' '; } }
string TextQuery::cleanup_str(const string &word) { string ret; for (auto it = word.begin(); it != word.end(); ++it) if (!ispunct(*it)) ret += tolower(*it); return ret; }
string TextQuery::cleanup_str(const string &word) { string ret; for (string::const_iterator it = word.begin(); it != word.end(); ++it) { if (!ispunct(*it)) ret += tolower(*it); } return ret; }