简体   繁体   中英

Python3, word2vec, How can I get the list of similarity rank about “price” in my model

In gensim's word2vec python, I want to get the list of cosine similarity for "price".

I read the document of gensim word2vec, but document it describes most_similar and n_similarity function)()

I want the whole list of similarity between price and all others.

If you call wv.most_similar('price', topn=len(wv)) , with a topn argument of the full vocabulary count of your model, you'll get back a ranked list of every word's similarity to 'price' .

If you call with topn=0 , you'll get the raw similarities with all model words, unsorted (in the order the words appear inside wv.index2entity ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM