Beispiel #1
0
 def test_dice_coefficient(self):
     # Returns 1.0 (identical strings).
     v = metrics.dice_coefficient("gallahad", "gallahad")
     self.assertEqual(v, 1.0)
     # Returns 0.25 (example from http://en.wikipedia.org/wiki/Dice_coefficient).
     v = metrics.dice_coefficient("night", "nacht")
     self.assertEqual(v, 0.25)
 def test_dice_coefficient(self):
     # Assert 1.0 (identical strings).
     v = metrics.dice_coefficient("gallahad", "gallahad")
     self.assertEqual(v, 1.0)
     # Assert 0.25 (example from
     # http://en.wikipedia.org/wiki/Dice_coefficient).
     v = metrics.dice_coefficient("night", "nacht")
     self.assertEqual(v, 0.25)
     print("pattern.metrics.dice_coefficient()")
Beispiel #3
0
 def test_dice_coefficient(self):
     # Assert 1.0 (identical strings).
     v = metrics.dice_coefficient("gallahad", "gallahad")
     self.assertEqual(v, 1.0)
     # Assert 0.25 (example from
     # http://en.wikipedia.org/wiki/Dice_coefficient).
     v = metrics.dice_coefficient("night", "nacht")
     self.assertEqual(v, 0.25)
     print("pattern.metrics.dice_coefficient()")
 def test_similarity(self):
     self.assertEqual(
         metrics.levenshtein_similarity("night", "nacht"),
         metrics.similarity("night", "nacht", metrics.LEVENSHTEIN))
     self.assertEqual(metrics.dice_coefficient("night", "nacht"),
                      metrics.similarity("night", "nacht", metrics.DICE))
     print("pattern.metrics.similarity()")
Beispiel #5
0
 def test_similarity(self):
     self.assertEqual(
         metrics.levenshtein_similarity("night", "nacht"), 
         metrics.similarity("night", "nacht", metrics.LEVENSHTEIN))
     self.assertEqual(
         metrics.dice_coefficient("night", "nacht"), 
         metrics.similarity("night", "nacht", metrics.DICE))