Пример #1
0
 def test_bleu_same_different_case(self):
     ref = self._create_temp_file("Test 1 two 3\nmore tests!")
     hyp = self._create_temp_file("test 1 two 3\nMore tests!")
     uncased_score = file_bleu(ref, hyp, case_sensitive=False)
     cased_score = file_bleu(ref, hyp, case_sensitive=True)
     self.assertEqual(100, uncased_score)
     self.assertLess(cased_score, 100)
Пример #2
0
 def test_bleu_different(self):
     ref = self._create_temp_file("Testing\nmore tests!")
     hyp = self._create_temp_file("Dog\nCat")
     uncased_score = file_bleu(ref, hyp, case_sensitive=False)
     cased_score = file_bleu(ref, hyp, case_sensitive=True)
     self.assertLess(uncased_score, 100)
     self.assertLess(cased_score, 100)
Пример #3
0
    def test_bleu_version(self):
        ref = self._create_temp_file("Test 1 two 3\nmore tests!")
        hyp = self._create_temp_file("test 1 two 3\nMore tests!")
        uncased_score = file_bleu(
            ref, hyp, bleu_version="corpus_bleu", case_sensitive=False)
        cased_score = file_bleu(
            ref, hyp, bleu_version="corpus_bleu", case_sensitive=True)
        self.assertEqual(100, uncased_score)
        self.assertLess(cased_score, 100)

        uncased_score = file_bleu(
            ref, hyp, bleu_version="corpus_bleu_moses", case_sensitive=False)
        cased_score = file_bleu(
            ref, hyp, bleu_version="corpus_bleu_moses", case_sensitive=True)
        self.assertEqual(100, uncased_score)
        self.assertLess(cased_score, 100)