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)
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)
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)
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)
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)
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)
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)
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)