import gensim

model = gensim.models.KeyedVectors.load_word2vec_format('path/to/word2vec.bin', binary=True)

word = 'bank'

similar_words = model.wv.most_similar(word)

meaning_1 = ['account', 'deposit', 'loan', 'credit', 'transaction'] meaning_2 = ['river', 'shore', 'canal', 'embankment', 'water']

for w in similar_words: if w[0] in meaning_1 and w[0] in meaning_2: print(word, "has two different meanings and its top-10 similar words contain related words from both meanings.") brea

Please complete it in Python code:Polysemes and homonyms are words that have more than one meaning see this wiki page to learn more about the difference between polysemes and homonyms Find a word wit

原文地址: https://www.cveoy.top/t/topic/eDnu 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录