Beispiel #1
0
 def testRougeLPartialOverlap(self):
   hypotheses = np.array([[1, 2, 3, 4, 5, 1, 6, 7, 0],
                          [1, 2, 3, 4, 5, 1, 6, 8, 7]])
   references = np.array([[1, 9, 2, 3, 4, 5, 1, 10, 6, 7],
                          [1, 9, 2, 3, 4, 5, 1, 10, 6, 7]])
   self.assertAllClose(
       rouge.rouge_l_sentence_level(hypotheses, references), 0.837, atol=1e-03)
Beispiel #2
0
 def testRougeLIdentical(self):
   hypotheses = np.array([[1, 2, 3, 4, 5, 1, 6, 7, 0],
                          [1, 2, 3, 4, 5, 1, 6, 8, 7]])
   references = np.array([[1, 2, 3, 4, 5, 1, 6, 7, 0],
                          [1, 2, 3, 4, 5, 1, 6, 8, 7]])
   self.assertAllClose(
       rouge.rouge_l_sentence_level(hypotheses, references), 1.0, atol=1e-03)
Beispiel #3
0
 def testRougeLPartialOverlap(self):
   hypotheses = np.array([[1, 2, 3, 4, 5, 1, 6, 7, 0],
                          [1, 2, 3, 4, 5, 1, 6, 8, 7]])
   references = np.array([[1, 9, 2, 3, 4, 5, 1, 10, 6, 7],
                          [1, 9, 2, 3, 4, 5, 1, 10, 6, 7]])
   self.assertAllClose(
       rouge.rouge_l_sentence_level(hypotheses, references), 0.837, atol=1e-03)
Beispiel #4
0
 def testRougeLIdentical(self):
   hypotheses = np.array([[1, 2, 3, 4, 5, 1, 6, 7, 0],
                          [1, 2, 3, 4, 5, 1, 6, 8, 7]])
   references = np.array([[1, 2, 3, 4, 5, 1, 6, 7, 0],
                          [1, 2, 3, 4, 5, 1, 6, 8, 7]])
   self.assertAllClose(
       rouge.rouge_l_sentence_level(hypotheses, references), 1.0, atol=1e-03)
Beispiel #5
0
 def testRougeLDisjoint(self):
     hypotheses = np.array([[1, 2, 3, 4, 5, 1, 6, 7, 0],
                            [1, 2, 3, 4, 5, 1, 6, 8, 7]])
     references = np.array([[8, 9, 10, 11, 12, 13, 14, 15, 16, 17],
                            [9, 10, 11, 12, 13, 14, 15, 16, 17, 0]])
     self.assertEqual(rouge.rouge_l_sentence_level(hypotheses, references),
                      0.0)
Beispiel #6
0
 def testRougeLDisjoint(self):
   hypotheses = np.array([[1, 2, 3, 4, 5, 1, 6, 7, 0],
                          [1, 2, 3, 4, 5, 1, 6, 8, 7]])
   references = np.array([[8, 9, 10, 11, 12, 13, 14, 15, 16, 17],
                          [9, 10, 11, 12, 13, 14, 15, 16, 17, 0]])
   self.assertEqual(rouge.rouge_l_sentence_level(hypotheses, references), 0.0)