Beispiel #1
0
 def test_rouge_n1_all(self):
     self.assertAlmostEqual(rouge_n(self.s1, self.references, 1), 
                      0.25, 2)
Beispiel #2
0
 def test_rouge_n2_all(self):
     self.assertAlmostEqual(rouge_n(self.s1, self.references, 2), 
                            0.17, 2)
Beispiel #3
0
 def test_rouge_n3(self):
     self.assertEqual(rouge_n(self.s1, [self.s2], 3), 
                      0.0)
Beispiel #4
0
 def test_rouge_n2(self):
     self.assertAlmostEqual(rouge_n(self.s1, [self.s2], 2), 
                            0.33, 2)
Beispiel #5
0
 def test_rouge_n1(self):
     self.assertAlmostEqual(rouge_n(self.s1, [self.s2], 1), 
                            0.75, 2)
Beispiel #6
0
 def test_rouge_n_identiy_2(self):
     # if n is so large that no ngram fits,
     # then ROUGE-N is zero.... ! 
     self.assertEqual(rouge_n(self.s1, [self.s1],
                              len(self.s1) + 1), 
                              0.0)
Beispiel #7
0
 def test_rouge_n_identiy_1(self):
     for n in range(1, len(self.s1) + 1):
         self.assertEqual(rouge_n(self.s1, [self.s1], n), 
                          1.0)