コード例 #1
0
ファイル: test_utils.py プロジェクト: zzl0/ChatterBot
    def test_consecutive_spaces_removed(self):

        text = 'The       quick brown     fox      jumps over the lazy dog.'
        clean_text = utils.clean_whitespace(text)
        normal_text = 'The quick brown fox jumps over the lazy dog.'

        self.assertEqual(clean_text, normal_text)
コード例 #2
0
ファイル: test_utils.py プロジェクト: jianjun66/ChatterBot
    def test_consecutive_spaces_removed(self):

        text = 'The       quick brown     fox      jumps over the lazy dog.'
        clean_text = utils.clean_whitespace(text)
        normal_text = 'The quick brown fox jumps over the lazy dog.'

        self.assertEqual(clean_text, normal_text)
コード例 #3
0
ファイル: test_utils.py プロジェクト: zzl0/ChatterBot
    def test_leading_or_trailing_whitespace_removed(self):

        text = '     The quick brown fox jumps over the lazy dog.   '
        clean_text = utils.clean_whitespace(text)
        normal_text = 'The quick brown fox jumps over the lazy dog.'

        self.assertEqual(clean_text, normal_text)
コード例 #4
0
ファイル: test_utils.py プロジェクト: jianjun66/ChatterBot
    def test_leading_or_trailing_whitespace_removed(self):

        text = '     The quick brown fox jumps over the lazy dog.   '
        clean_text = utils.clean_whitespace(text)
        normal_text = 'The quick brown fox jumps over the lazy dog.'

        self.assertEqual(clean_text, normal_text)
コード例 #5
0
 def remove_mentions(self, text):
     """
     Return a string that has no leading mentions.
     """
     import re
     from chatterbot.utils import clean_whitespace
     text_without_mentions = re.sub(r'@\S+', '', text)
     return clean_whitespace(text_without_mentions)
コード例 #6
0
ファイル: gitter.py プロジェクト: jianjun66/ChatterBot
 def remove_mentions(self, text):
     """
     Return a string that has no leading mentions.
     """
     import re
     from chatterbot.utils import clean_whitespace
     text_without_mentions = re.sub(r'@\S+', '', text)
     return clean_whitespace(text_without_mentions)
コード例 #7
0
ファイル: test_utils.py プロジェクト: zzl0/ChatterBot
    def test_clean_whitespace(self):
        text = '\tThe quick \nbrown fox \rjumps over \vthe \alazy \fdog\\.'
        clean_text = utils.clean_whitespace(text)
        normal_text = 'The quick brown fox jumps over \vthe \alazy \fdog\\.'

        self.assertEqual(clean_text, normal_text)
コード例 #8
0
ファイル: test_utils.py プロジェクト: jianjun66/ChatterBot
    def test_clean_whitespace(self):
        text = '\tThe quick \nbrown fox \rjumps over \vthe \alazy \fdog\\.'
        clean_text = utils.clean_whitespace(text)
        normal_text = 'The quick brown fox jumps over \vthe \alazy \fdog\\.'

        self.assertEqual(clean_text, normal_text)