def test_calc_similarity_between_entities_positive05(self): gold_entity = (2, 8) predicted_entity = (3, 9) true_similarity = 0.714285714 true_tp = 5 true_fp = 1 true_fn = 1 similarity, tp, fp, fn = calc_similarity_between_entities(gold_entity, predicted_entity) self.assertAlmostEqual(true_similarity, similarity, places=4) self.assertEqual(true_tp, tp) self.assertEqual(true_fp, fp) self.assertEqual(true_fn, fn)
def test_calc_similarity_between_entities_positive07(self): gold_entity = (3, 9) predicted_entity = (0, 2) true_similarity = 0.0 true_tp = 0 true_fp = 2 true_fn = 6 similarity, tp, fp, fn = calc_similarity_between_entities(gold_entity, predicted_entity) self.assertAlmostEqual(true_similarity, similarity, places=4) self.assertEqual(true_tp, tp) self.assertEqual(true_fp, fp) self.assertEqual(true_fn, fn)
def test_calc_similarity_between_entities_positive02(self): gold_entity = (4, 8) predicted_entity = (3, 9) true_similarity = 0.666666667 true_tp = 4 true_fp = 2 true_fn = 0 similarity, tp, fp, fn = calc_similarity_between_entities(gold_entity, predicted_entity) self.assertAlmostEqual(true_similarity, similarity, places=4) self.assertEqual(true_tp, tp) self.assertEqual(true_fp, fp) self.assertEqual(true_fn, fn)