simple-search-engine
simple-search-engine copied to clipboard
Indexable class : 'dict_keys' object is not subscriptable
When I try to run the project on Python 3, I got : 'dict_keys' object is not subscriptable
.
Actually, after some research I have found out that in the following methods list
should be added to dictionary keys call.
def __repr__(self):
return ' '.join(list(self.words_count.keys())[:10])
and
def words_generator(self, stop_words):
for word in list(self.words_count.keys()):
if word not in stop_words or len(word) > 5:
yield word
Thanks for the callout, @jtoghrul! The implementation targeted Python > 2.7. It is great to see that it might also work with Python > 3 after a few minor changes.
Would you be interested in adjusting the implementation so that it becomes compatible with both Python 2 and 3? If you submit a pull request I can review and merge it right away.