def test_withAlphabet(self): text = "hello, world!" expected = [ "he", "el", "ll", "lo", "o ", " ", " w", "wo", "or", "rl", "ld", "d " ] ngrams = list(ta.ngrams(ta.characters(text, english, " "), 2)) self.assertEqual(ngrams, expected)
def test_noAlphabet(self): text = "hello, world" expected = list(text) chrs = list(ta.characters(text)) self.assertEqual(chrs, expected)
def test_withAlphabetRemoveMultiple(self): text = "hello, world" expected = ["h", "e", "l", "l", "o", " ", "w", "o", "r", "l", "d"] chrs = list(ta.characters(text, english, doubles=False)) self.assertEqual(chrs, expected)
def test_withAlphabetRemove(self): text = "hello, world" expected = ["h", "e", "l", "l", "o", "w", "o", "r", "l", "d"] chrs = list(ta.characters(text, english, rep=None)) self.assertEqual(chrs, expected)