Skip to content

Commit

Permalink
Merge branch 'smartirs' of github.com:markroxor/gensim into smartirs
Browse files Browse the repository at this point in the history
  • Loading branch information
markroxor committed Dec 26, 2017
2 parents 4afbadd + e5140f8 commit d2fe235
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gensim/test/test_tfidfmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def testPersistence(self):
tstvec = [corpus[1], corpus[2]]
self.assertTrue(np.allclose(model[tstvec[0]], model2[tstvec[0]]))
self.assertTrue(np.allclose(model[tstvec[1]], model2[tstvec[1]]))
self.assertTrue(np.allclose(model[[]], model2[[]])) # try projecting an empty vector
self.assertTrue(np.allclose(model[[]], model2[[]])) # try projecting an empty vector

# Test persistence with using `smartirs`
fname = get_tmpfile('gensim_models_smartirs.tst')
Expand All @@ -86,7 +86,7 @@ def testPersistence(self):
tstvec = [corpus[1], corpus[2]]
self.assertTrue(np.allclose(model[tstvec[0]], model2[tstvec[0]]))
self.assertTrue(np.allclose(model[tstvec[1]], model2[tstvec[1]]))
self.assertTrue(np.allclose(model[[]], model2[[]])) # try projecting an empty vector
self.assertTrue(np.allclose(model[[]], model2[[]])) # try projecting an empty vector

# Test persistence between Gensim v3.2.0 and current model.
model3 = tfidfmodel.TfidfModel(self.corpus, smartirs="ntc")
Expand All @@ -95,7 +95,7 @@ def testPersistence(self):
tstvec = [corpus[1], corpus[2]]
self.assertTrue(np.allclose(model3[tstvec[0]], model4[tstvec[0]]))
self.assertTrue(np.allclose(model3[tstvec[1]], model4[tstvec[1]]))
self.assertTrue(np.allclose(model3[[]], model4[[]])) # try projecting an empty vector
self.assertTrue(np.allclose(model3[[]], model4[[]])) # try projecting an empty vector

def testPersistenceCompressed(self):
# Test persistence without using `smartirs`
Expand All @@ -107,7 +107,7 @@ def testPersistenceCompressed(self):
tstvec = [corpus[1], corpus[2]]
self.assertTrue(np.allclose(model[tstvec[0]], model2[tstvec[0]]))
self.assertTrue(np.allclose(model[tstvec[1]], model2[tstvec[1]]))
self.assertTrue(np.allclose(model[[]], model2[[]])) # try projecting an empty vector
self.assertTrue(np.allclose(model[[]], model2[[]])) # try projecting an empty vector

# Test persistence with using `smartirs`
fname = get_tmpfile('gensim_models_smartirs.tst.gz')
Expand All @@ -118,7 +118,7 @@ def testPersistenceCompressed(self):
tstvec = [corpus[1], corpus[2]]
self.assertTrue(np.allclose(model[tstvec[0]], model2[tstvec[0]]))
self.assertTrue(np.allclose(model[tstvec[1]], model2[tstvec[1]]))
self.assertTrue(np.allclose(model[[]], model2[[]])) # try projecting an empty vector
self.assertTrue(np.allclose(model[[]], model2[[]])) # try projecting an empty vector

# Test persistence between Gensim v3.2.0 and current compressed model.
model3 = tfidfmodel.TfidfModel(self.corpus, smartirs="ntc")
Expand All @@ -127,7 +127,7 @@ def testPersistenceCompressed(self):
tstvec = [corpus[1], corpus[2]]
self.assertTrue(np.allclose(model3[tstvec[0]], model4[tstvec[0]]))
self.assertTrue(np.allclose(model3[tstvec[1]], model4[tstvec[1]]))
self.assertTrue(np.allclose(model3[[]], model4[[]])) # try projecting an empty vector
self.assertTrue(np.allclose(model3[[]], model4[[]])) # try projecting an empty vector

def TestConsistency(self):
docs = [corpus[1], corpus[2]]
Expand Down

0 comments on commit d2fe235

Please sign in to comment.