i am trying to make an inversed document index, therefore i need to know from all unique words in a collection in which doc they occur and how often.
i have used this an
It would be better to kick AutoVivification
out all together, because it adds nothing.
The following line:
if (word == keyword and dictionary[keyword][filename] is not None):
Doesn't work as expected, because of the way your class works, dictionary[keyword]
will always return an instance of AutoVivification
, and so will dictionary[keyword][filename]
.