Example #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)
Example #2
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()")
Example #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()")
Example #4
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))
     print("pattern.metrics.similarity()")
Example #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))