Build Chatbots with Python Skill Path - Retrieval Based Chatbots -gensim

Code is outdated as the gensim does not support anymore python2 .

Changes have been done:

similar_to_romeo = model.most_similar(“romeo”,topn=20)

is now

similar_to_romeo = model.wv.most_similar(“romeo”, topn=20)

and:

AttributeError: The vocab attribute was removed from KeyedVector in Gensim 4.0.0.
Use KeyedVector’s .key_to_index dict, .index_to_key list, and methods .get_vecattr(key, attr) and .set_vecattr(key, attr, new_val) instead.
See Migrating from Gensim 3.x to 4 · RaRe-Technologies/gensim Wiki · GitHub

on line

view vocabulary

vocabulary = list(model.wv.vocab.items())