コード例 #1
0
    def test_normalizeHyphens_notmatch_simple_reverse(self):
        hyp = "it's touch-interactive"
        ref = "touch interactive"
        actual = HypothesisNormalizer.normalize(hyp, ref)

        expected = "it's touch interactive"
        self.assertEqual(actual, expected)
コード例 #2
0
    def test_isDashEquivalent_false_back(self):
        hyp = "touch-interactive-"
        ref = "touch-interactive"
        actual = HypothesisNormalizer.normalize(hyp, ref)

        expected = "touch-interactive"
        self.assertEqual(actual, expected)
コード例 #3
0
    def test_normalize_ref_extra_words(self):
        hyp = "the fifty year old"
        ref = "a 50 year old"
        actual = HypothesisNormalizer.normalize(hyp, ref)

        expected = "the 50 year old"
        self.assertEqual(actual, expected)
コード例 #4
0
    def test_normalize_fifty_year_old_num_hyphen(self):
        # TODO: This one has a hyphenation issue that needs to be resolved.
        hyp = "fifty year old"
        ref = "50-year-old"
        actual = HypothesisNormalizer.normalize(hyp, ref)

        self.assertEqual(actual, ref)
コード例 #5
0
    def test_normalize_words_missing_front(self):
        hyp = "hundred thirty four thousand"
        ref = "two hundred thirty four thousand"
        actual = HypothesisNormalizer.normalize(hyp, ref)

        self.assertEqual(actual, hyp)
        self.assertNotEqual(actual, ref)
コード例 #6
0
 def test_normalizeHyphens_true(self):
     hyp = "one two one life"
     ref = "one-to-one"
     actual = HypothesisNormalizer.normalize(hyp, ref)
     expected = ref
     self.assertNotEqual(actual, expected)
コード例 #7
0
 def test_normalize_middle_age(self):
     ref = "than middle-aged"
     hyp = "the middle age"
     expected = "the middle age"
     actual = HypothesisNormalizer.normalize(hyp, ref)
     self.assertEqual(actual, expected)
コード例 #8
0
    def test_normalize_fifty_year_old(self):
        hyp = "fifty year old"
        ref = "50 year old"
        actual = HypothesisNormalizer.normalize(hyp, ref)

        self.assertEqual(actual, ref)
コード例 #9
0
    def test_normalize_words_hyphen(self):
        hyp = "two hundred thirty-four thousand"
        ref = "two hundred thirty four thousand"
        actual = HypothesisNormalizer.normalize(hyp, ref)

        self.assertEqual(actual, ref)
コード例 #10
0
    def test_normalize_digits(self):
        hyp = "234000"
        ref = "two hundred thirty four thousand"
        actual = HypothesisNormalizer.normalize(hyp, ref)

        self.assertEqual(actual, ref)