使用most_similar()
函数即可,代码如下:
from gensim.models import Word2Vec
word_model = Word2Vec.load('wiki_word2vec_model') # 导入模型
word_model.wv.most_similar(['word','proverb']) # 这个list里可以输入多个词
返回结果:
[('phrase', 0.7695871591567993),
('verse', 0.6313120126724243),
('quotation', 0.6233633160591125),
('idiom', 0.6210076212882996),
('aphorism', 0.5964066386222839),
('literal', 0.5599628686904907),
('rhyme', 0.5577985048294067),
('phraseology', 0.5565248131752014),
('paraphrase', 0.5559581518173218),
('simile', 0.5532975792884827)]