gensim.models.Word2Vec.similar_by_vector¶
-
Word2Vec.
similar_by_vector
(vector, topn=10, restrict_vocab=None)[source]¶ Find the top-N most similar words by vector.
If topn is False, similar_by_vector returns the vector of similarity scores.
restrict_vocab is an optional integer which limits the range of vectors which are searched for most-similar values. For example, restrict_vocab=10000 would only check the first 10000 word vectors in the vocabulary order. (This may be meaningful if you’ve sorted the vocabulary by descending frequency.)
Example:
>>> trained_model.similar_by_vector([1,2]) [('survey', 0.9942699074745178), ...]