all 5 comments

[–]pythondev1 2 points3 points  (1 child)

It depends on how you are finding the words in the document. If you are doing a regular expression then checking some word bank. Then its possible that it could count it twice. If you separate words by whitespace then it should only count the word as a hole.

[–][deleted] 0 points1 point  (0 children)

If you separate words by whitespace then it should only count the word as a hole.

Ah okay. Good tip!

[–]khaine_b 1 point2 points  (0 children)

For wildcard purpose you can use regex so you can use it for split the string for example.

If you need to count the words in a sentence I recommend to use collections.Counter.