I’m reading in several documents, and indexing the words I read in. However, I want to ignore common case words (a, an, the, and, is, or, are, etc).
Is there a shortcut to doing this? Moreso than doing just…
if(word==”and” || word==”is” || etc etc….) ignore word;
For example, can I put them into a const string somehow, and have it just check against the string? Not sure… thank you!
Create a
set<string>with the words that you would like to exclude, and usemySet.count(word)to determine if the word is in the set. If it is, the count will be1; it will be0otherwise.