Skip to content

Commit

Permalink
Add an ordering test for LevenshteinSimilarityIndex.most_similar
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Jan 12, 2019
1 parent 0d7f611 commit 290ae3a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gensim/test/test_similarities.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,11 @@ def test_most_similar(self):
self.assertLess(1, len(results))
self.assertGreaterEqual(4, len(results))

# check the order of the results
result = index.most_similar(u"holiday", topn=1)
term, _ = next(result)
self.assertEqual(u"hollingworth", term)

# check that the term itself is not returned
index = LevenshteinSimilarityIndex(self.dictionary)
terms = [term for term, similarity in index.most_similar(u"holiday", topn=len(self.dictionary))]
Expand Down

0 comments on commit 290ae3a

Please sign in to comment.