Skip to content

Commit

Permalink
Make Soft Cosine Measure support non-contiguous dictionaries (cont)
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Jul 2, 2018
1 parent 227d09e commit 9f8d0e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gensim/similarities/termsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(self, dictionary, term_similarity=0.5):

def most_similar(self, t1, topn=10):
for __, (t2_index, t2) in zip(range(topn), (
(t2_index, t2) for t2_index, t2 in self.dictionary.items() if t2 != t1)):
(t2_index, t2) for t2_index, t2 in sorted(self.dictionary.items()) if t2 != t1)):
yield (t2, self.term_similarity)


Expand Down Expand Up @@ -161,7 +161,7 @@ def __init__(self, source, dictionary=None, tfidf=None, symmetric=True, nonzero_

if tfidf is None:
logger.info("iterating over columns in dictionary order")
columns = sorted(dictionary.keys)
columns = sorted(dictionary.keys())
else:
assert max(tfidf.idfs) == matrix_order - 1
logger.info("iterating over columns in tf-idf order")
Expand Down

0 comments on commit 9f8d0e8

Please sign in to comment.