コード例 #1
0
 def test_replace_one_token_1(self):
     assert regex_token_replace(sentence="She is a baller.",
                                token='she',
                                replacement=SIMPLE_REPLACE['she']) == \
            "They is a baller."
コード例 #2
0
 def test_replace_token_capitalization_2(self):
     assert regex_token_replace(sentence="Weatherman",
                                token='weatherman',
                                replacement=SIMPLE_REPLACE['weatherman']) == \
            "Weather reporter"
コード例 #3
0
 def test_replace_token_capitalization_3(self):
     assert regex_token_replace(sentence="chairman",
                                token='chairman',
                                replacement=SIMPLE_REPLACE['chairman']) == \
            "chair"
コード例 #4
0
 def test_replace_token_capitalization_1(self):
     assert regex_token_replace(sentence="MANKIND",
                                token='mankind',
                                replacement=SIMPLE_REPLACE['mankind']) == \
            "HUMANITY"
コード例 #5
0
 def test_replace_multiple_tokens_3(self):
     assert regex_token_replace(sentence="Stewardess stewardess stewardess.",
                                token='stewardess',
                                replacement=SIMPLE_REPLACE['stewardess']) == \
            "Flight attendant flight attendant flight attendant."
コード例 #6
0
 def test_replace_multiple_tokens_2(self):
     assert regex_token_replace(sentence="He was tired because he had the flu.",
                                token='he',
                                replacement=SIMPLE_REPLACE['he']) == \
            "They was tired because they had the flu."
コード例 #7
0
 def test_replace_one_token_4(self):
     assert regex_token_replace(sentence="The policeman was a sergeant.",
                                token='policeman',
                                replacement=SIMPLE_REPLACE['policeman']) == \
            "The police officer was a sergeant."
コード例 #8
0
 def test_replace_one_token_3(self):
     assert regex_token_replace(sentence="The kitty was saved by the fireman.",
                                token='fireman',
                                replacement=SIMPLE_REPLACE['fireman']) == \
            "The kitty was saved by the firefighter."