Example #1
0
 def test_cosine_empty_1(self):
     self.assertEqual(cosine("",""), 0.0)
Example #2
0
def cosine_sim(source_terms, target_terms, *args):
    return sim.cosine(source_terms, target_terms)
Example #3
0
 def test_cosine_symmetry(self):
     self.assertEqual(cosine("ab","bc"), cosine("bc","ab"))
Example #4
0
 def test_cosine_1(self):
     self.assertAlmostEqual(cosine("levenshtein","leuwenhstijn"), 0.609, 3)
Example #5
0
 def test_cosine_identity(self):
     self.assertEqual(cosine("a","a"), 1.0)
Example #6
0
 def test_cosine_empty_1(self):
     self.assertEqual(cosine("", ""), 0.0)
Example #7
0
 def test_cosine_1(self):
     self.assertAlmostEqual(cosine("levenshtein", "leuwenhstijn"), 0.609, 3)
Example #8
0
 def test_cosine_symmetry(self):
     self.assertEqual(cosine("ab", "bc"), cosine("bc", "ab"))
Example #9
0
 def test_cosine_identity(self):
     self.assertEqual(cosine("a", "a"), 1.0)