Esempio n. 1
0
    def test_iterable_input(self):
        """Function should return correct values when called with valid iterables as input"""
        self.assertEqual(fuzzycomp.tversky_index(["He", "el", "ll", "lo"], ["He", "el", "ll", "lo"], 1.0, 1.0), 1.0)
        self.assertEqual(fuzzycomp.tversky_index(["fo", "oo"], ["ba", "ar"], 1.0, 1.0), 0.0)

        self.assertEqual(fuzzycomp.tversky_index(("He", "el", "ll", "lo"), ("He", "el", "ll", "lo"), 1.0, 1.0), 1.0)
        self.assertEqual(fuzzycomp.tversky_index(("fo", "oo"), ("ba", "ar"), 1.0, 1.0), 0.0)
Esempio n. 2
0
    def test_iterable_input(self):
        """Function should return correct values when called with valid iterables as input"""
        self.assertEqual(
            fuzzycomp.tversky_index(["He", "el", "ll", "lo"],
                                    ["He", "el", "ll", "lo"], 1.0, 1.0), 1.0)
        self.assertEqual(
            fuzzycomp.tversky_index(["fo", "oo"], ["ba", "ar"], 1.0, 1.0), 0.0)

        self.assertEqual(
            fuzzycomp.tversky_index(("He", "el", "ll", "lo"),
                                    ("He", "el", "ll", "lo"), 1.0, 1.0), 1.0)
        self.assertEqual(
            fuzzycomp.tversky_index(("fo", "oo"), ("ba", "ar"), 1.0, 1.0), 0.0)
Esempio n. 3
0
 def test_dice_similarity(self):
     """If alpha=beta=0.5 function should produce the same result as Dice Coefficient"""
     self.assertEqual(
         fuzzycomp.tversky_index("night", "nacht", 0.5, 0.5), fuzzycomp.dice_coefficient("night", "nacht")
     )
Esempio n. 4
0
 def test_case_sensitive(self):
     """Function should be case sensitive"""
     self.assertNotEqual(fuzzycomp.tversky_index("hello", "HELLO", 1.0, 1.0), 1.0)
Esempio n. 5
0
 def test_valid_input(self):
     """Function should return correct values under valid input"""
     self.assertEqual(fuzzycomp.tversky_index("Hello", "Hello", 1.0, 1.0), 1.0)
     self.assertEqual(fuzzycomp.tversky_index("foo", "bar", 1.0, 1.0), 0.0)
Esempio n. 6
0
 def test_dice_similarity(self):
     """If alpha=beta=0.5 function should produce the same result as Dice Coefficient"""
     self.assertEqual(fuzzycomp.tversky_index("night", "nacht", 0.5, 0.5),
                      fuzzycomp.dice_coefficient("night", "nacht"))
Esempio n. 7
0
 def test_case_sensitive(self):
     """Function should be case sensitive"""
     self.assertNotEqual(
         fuzzycomp.tversky_index("hello", "HELLO", 1.0, 1.0), 1.0)
Esempio n. 8
0
 def test_valid_input(self):
     """Function should return correct values under valid input"""
     self.assertEqual(fuzzycomp.tversky_index("Hello", "Hello", 1.0, 1.0),
                      1.0)
     self.assertEqual(fuzzycomp.tversky_index("foo", "bar", 1.0, 1.0), 0.0)