word2vec.WordVectors.cosine

WordVectors.cosine(word, n=10)[source]

Cosine similarity.

metric = dot(vectors_of_vectors, vectors_of_target_vector) Uses a precomputed vectors of the vectors

Parameters:

word : string

n : int, optional (default 10)

number of neighbors to return

Returns:

2 numpy.array:

  1. position in self.vocab
  2. cosine similarity