Exemple #1
0
 def test_get_actual_utterance_multiple_occurences_of_each(self):
     """Test with 2 shortenings, 2 fragments and 2 replacements."""
     utterance = ('(A)mu:(ğ)ça yarasam [: yorosom] '
                  '&ab yarasam [: yorosom] &ac')
     actual_output = Extractor.to_actual_utterance(utterance)
     desired_output = 'mu:ça yarasam ab yarasam ac'
     self.assertEqual(actual_output, desired_output)
Exemple #2
0
    def get_target_utterance(self):
        """Get the target form of the utterance.

        Returns: str
        """
        utterance = self.get_utterance()
        return ActualTargetUtteranceExtractor.to_target_utterance(utterance)
Exemple #3
0
 def test_get_replacement_target_multiple_replacements(self):
     """Test get_replacement_target with 3 replacements."""
     utterance = 'yarasam [: yorosom] yarasam [: yorosom] ' \
                 'yarasam [: yorosom] .'
     actual_output = Extractor.get_replacement_target(utterance)
     desired_output = 'yorosom yorosom yorosom .'
     self.assertEqual(actual_output, desired_output)
Exemple #4
0
 def test_to_target_utterance_multiple_occurrences_of_each(self):
     """Test with 2 shortenings, 2 fragments and 2 replacements."""
     utterance = ('yarasam [: yorosom] '
                  '&ab (a)mu:(ğ)ça  &ac yarasam [: yorosom]')
     actual_output = Extractor.to_target_utterance(utterance)
     desired_output = 'yorosom xxx amu:ğça  xxx yorosom'
     self.assertEqual(actual_output, desired_output)
Exemple #5
0
 def test_get_retracing_actual_retracing_several_words_no_whitespace(self):
     """Test retracing with several words and missing whitespace."""
     utterance = '<this is>[/] this is a test'
     actual_output = Extractor.get_retracing_actual(utterance)
     desired_output = 'this is this is a test'
     self.assertEqual(actual_output, desired_output)
Exemple #6
0
 def test_get_retracing_target_correction_no_whitespace(self):
     """Test with correction and missing whitespace."""
     utterance = 'this us[//] is a test'
     actual_output = Extractor.get_retracing_target(utterance)
     desired_output = 'this is is a test'
     self.assertEqual(actual_output, desired_output)
Exemple #7
0
 def test_get_shortening_target_empty_string(self):
     """Test get_shortening_target with an empty string."""
     utterance = ''
     actual_output = Extractor.get_shortening_target(utterance)
     desired_output = ''
     self.assertEqual(actual_output, desired_output)
Exemple #8
0
 def test_get_shortening_target_special_characters(self):
     """Test get_shortening_target with special chars in parentheses."""
     utterance = 'Mu:(ğ)ça .'
     actual_output = Extractor.get_shortening_target(utterance)
     desired_output = 'Mu:ğça .'
     self.assertEqual(actual_output, desired_output)
Exemple #9
0
 def test_get_shortening_target_multiple_shortenings(self):
     """Test get_shortening_target with 3 shortening occurence."""
     utterance = '(o)na:(ra)da dükäm lan(da) [?] [>] ?'
     actual_output = Extractor.get_shortening_target(utterance)
     desired_output = 'ona:rada dükäm landa [?] [>] ?'
     self.assertEqual(actual_output, desired_output)
Exemple #10
0
 def test_get_actual_utterance_nesting(self):
     """Test with nesting."""
     utterance = '<it shoulda[: should have]> [<2] ?'
     actual_output = Extractor.to_actual_utterance(utterance)
     desired_output = '<it shoulda> [<2] ?'
     self.assertEqual(actual_output, desired_output)
Exemple #11
0
 def test_to_target_utterance_no_occurrences(self):
     """Test to_target_utterance using an utterance without occurrences."""
     utterance = 'mu:ça yarasam ab yarasam ac'
     actual_output = Extractor.to_target_utterance(utterance)
     desired_output = 'mu:ça yarasam ab yarasam ac'
     self.assertEqual(actual_output, desired_output)
Exemple #12
0
 def test_get_retracing_actual_reformulation(self):
     """Test get_retracing_actual."""
     utterance = 'what [///] why do you eat'
     actual_output = Extractor.get_retracing_actual(utterance)
     desired_output = 'what why do you eat'
     self.assertEqual(actual_output, desired_output)
Exemple #13
0
 def test_get_retracing_actual_no_whitespace(self):
     """Test with missing whitespace."""
     utterance = 'this is[/] is a test'
     actual_output = Extractor.get_retracing_actual(utterance)
     desired_output = 'this is is a test'
     self.assertEqual(actual_output, desired_output)
Exemple #14
0
 def test_get_retracing_actual_correction(self):
     """Test get_retracing_actual."""
     utterance = 'this us [//] is a test'
     actual_output = Extractor.get_retracing_actual(utterance)
     desired_output = 'this us is a test'
     self.assertEqual(actual_output, desired_output)
Exemple #15
0
 def test_get_retracing_actual_retracing_several_words(self):
     """Test get_retracing_actual."""
     utterance = '<this is> [/] this is a test'
     actual_output = Extractor.get_retracing_actual(utterance)
     desired_output = 'this is this is a test'
     self.assertEqual(actual_output, desired_output)
Exemple #16
0
 def test_get_fragment_target_ampersand_inside_word(self):
     """Test with ampersand occurring inside the word."""
     utterance = 'dont&handle'
     actual_output = Extractor.get_fragment_target(utterance)
     desired_output = 'dont&handle'
     self.assertEqual(actual_output, desired_output)
Exemple #17
0
 def test_get_fragment_target_one_char_fragment(self):
     """Test with a fragment consisting of one character."""
     utterance = 'This is &a test'
     actual_output = Extractor.get_fragment_target(utterance)
     desired_output = 'This is xxx test'
     self.assertEqual(actual_output, desired_output)
Exemple #18
0
 def test_get_fragment_target_ampersand_outside(self):
     """Test get_fragment_target with ampersand outside fragment."""
     utterance = '&=laugh &wow &-um'
     actual_output = Extractor.get_fragment_target(utterance)
     desired_output = '&=laugh xxx &-um'
     self.assertEqual(actual_output, desired_output)
Exemple #19
0
 def test_to_target_utterance_empty_string(self):
     utterance = ''
     actual_output = Extractor.to_target_utterance(utterance)
     desired_output = ''
     self.assertEqual(actual_output, desired_output)
Exemple #20
0
 def test_get_retracing_target_retracing(self):
     """Test get_retracing_target."""
     utterance = 'this is [/] is a test'
     actual_output = Extractor.get_retracing_target(utterance)
     desired_output = 'this is is a test'
     self.assertEqual(actual_output, desired_output)
Exemple #21
0
 def test_to_target_utterance_one_occurrence_of_each(self):
     """Test with 1 shortening, 1 fragment and 1 replacement."""
     utterance = 'Mu:(ğ)ça &ab yarasam [: yorosom]'
     actual_output = Extractor.to_target_utterance(utterance)
     desired_output = 'Mu:ğça xxx yorosom'
     self.assertEqual(actual_output, desired_output)
Exemple #22
0
 def test_get_shortening_actual_no_shortening(self):
     """Test get_shortening_actual using utt without shortening."""
     utterance = 'Tu:çe .'
     actual_output = Extractor.get_shortening_actual(utterance)
     desired_output = 'Tu:çe .'
     self.assertEqual(actual_output, desired_output)
Exemple #23
0
 def test_get_shortening_target_standard_case(self):
     """Test get_shortening_target with 1 shortening occurence."""
     utterance = 'na:(ra)da <dükäm lan> [?] [>] ?'
     actual_output = Extractor.get_shortening_target(utterance)
     desired_output = 'na:rada <dükäm lan> [?] [>] ?'
     self.assertEqual(actual_output, desired_output)
Exemple #24
0
 def test_get_retracing_target_correction_several_words(self):
     """Test get_retracing_target."""
     utterance = '<this us> [//] this is a test'
     actual_output = Extractor.get_retracing_target(utterance)
     desired_output = 'this us this is a test'
     self.assertEqual(actual_output, desired_output)
Exemple #25
0
 def test_get_shortening_target_non_shortening_parentheses(self):
     """Test get_shortening_target with non shortening parentheses."""
     utterance = 'mo:(ra)da (.) mu ?'
     actual_output = Extractor.get_shortening_target(utterance)
     desired_output = 'mo:rada (.) mu ?'
     self.assertEqual(actual_output, desired_output)
Exemple #26
0
 def test_get_retracing_target_reformulation_several_words(self):
     """Test get_retracing_target."""
     utterance = '<for what> [///] why do you eat'
     actual_output = Extractor.get_retracing_target(utterance)
     desired_output = 'for what why do you eat'
     self.assertEqual(actual_output, desired_output)
Exemple #27
0
 def test_get_shortening_target_no_shortening(self):
     """Test get_shortening_target using utt without a shortening."""
     utterance = 'Mu:ça .'
     actual_output = Extractor.get_shortening_target(utterance)
     desired_output = 'Mu:ça .'
     self.assertEqual(actual_output, desired_output)
Exemple #28
0
 def test_get_retracing_target_false_start(self):
     """Test get_retracing_target."""
     utterance = 'I want [/-] would do that'
     actual_output = Extractor.get_retracing_target(utterance)
     desired_output = 'I want would do that'
     self.assertEqual(actual_output, desired_output)
Exemple #29
0
 def test_get_replacement_actual_one_replacement(self):
     """Test get_replacement_actual with 1 replacement."""
     utterance = 'yarasam [: yorosom] .'
     actual_output = Extractor.get_replacement_actual(utterance)
     desired_output = 'yarasam .'
     self.assertEqual(actual_output, desired_output)
Exemple #30
0
 def test_get_retracing_target_false_start_several_words(self):
     """Test get_retracing_target."""
     utterance = '<I want> [///] what do you eat'
     actual_output = Extractor.get_retracing_target(utterance)
     desired_output = 'I want what do you eat'
     self.assertEqual(actual_output, desired_output)