def testRouge2PartialOverlap(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_n(hypotheses, references), 0.53, atol=1e-03)
def testRouge2Identical(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_n(hypotheses, references), 1.0, atol=1e-03)
def testRouge2Disjoint(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_n(hypotheses, references), 0.0)