Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sj29-innovate committed Jan 11, 2018
1 parent a2a4c61 commit fbf4fad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Binary file removed Keras-2.1.2-py2.7.egg
Binary file not shown.
10 changes: 5 additions & 5 deletions gensim/test/test_BM25.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ def test_max_match_with_itself(self):
for index, doc_weights in enumerate(weights):
expected = max(doc_weights)
predicted = doc_weights[index]
self.assertEqual(expected, predicted)
self.assertAlmostEqual(expected, predicted)

def test_nonnegative_weights(self):
""" All the weights for a partiular document should be non negative """
weights = get_bm25_weights(common_texts)
for doc_weights in weights:
for weight in doc_weights:
self.assertTrue(weight >= 0)
self.assertTrue(weight >= 0.)

def test_same_match_with_same_document(self):
""" A document should always get the same weight when matched with a particular document """
corpus = [['cat', 'dog', 'mouse'], ['cat', 'lion'], ['cat', 'lion']]
weights = get_bm25_weights(corpus)
self.assertEqual(weights[0][1], weights[0][2])
self.assertAlmostEqual(weights[0][1], weights[0][2])

def test_disjoint_docs_if_weight_zero(self):
""" Two disjoint documents should have zero matching"""
corpus = [['cat', 'dog', 'lion'], ['goat', 'fish', 'tiger']]
weights = get_bm25_weights(corpus)
self.assertTrue(weights[0][1] == 0)
self.assertTrue(weights[1][0] == 0)
self.assertAlmostEqual(weights[0][1], 0)
self.assertAlmostEqual(weights[1][0], 0)


if __name__ == '__main__':
Expand Down

0 comments on commit fbf4fad

Please sign in to comment.