Splits a string into ngram words
(s, n)
| 37 | |
| 38 | |
| 39 | def word_ngrams(s, n): |
| 40 | """Splits a string into ngram words""" |
| 41 | tokens = s.split() # not a generator :( |
| 42 | ngram_seqs = form_ngrams(iter(tokens), n) |
| 43 | return (" ".join(ngram) for ngram in ngram_seqs) |
| 44 | |
| 45 | |
| 46 | # Does character sequences only - combined faster function to play around with later |
no test coverage detected