concept two document in category python

appears as: two documents
Get Programming: Learn to code with Python

This is an excerpt from Manning's book Get Programming: Learn to code with Python.

After you finish going through one dictionary, go through the other dictionary. You no longer need to look at the difference between the two dictionary values because you already counted that previously. Now you’re just looking to see whether any words in the other dictionary weren’t in the first one. If so, add up their counts.

29.7. One possible extension

You can make your program more robust by looking at pairs of words instead of single words. After you read the file as a string, look at pairs of words, called bigrams, and save them in a list. Looking at bigrams instead of words can improve your program because pairs of words often give a better indication of similarity in languages. This could lead to a more accurate setup and a better model of written text. If you want, you could also use a mixture of bigrams and words when you calculate a similarity score.