Skip to content

Commit

Permalink
Make topn=None disable indexer in most_similar
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Apr 23, 2019
1 parent 6d89673 commit ad788ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gensim/models/keyedvectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def most_similar(self, positive=None, negative=None, topn=10, restrict_vocab=Non
raise ValueError("cannot compute similarity with no input")
mean = matutils.unitvec(array(mean).mean(axis=0)).astype(REAL)

if indexer is not None:
if indexer is not None and isinstance(topn, int):
return indexer.most_similar(mean, topn)

limited = self.vectors_norm if restrict_vocab is None else self.vectors_norm[:restrict_vocab]
Expand Down

0 comments on commit ad788ea

Please sign in to comment.