Return only the subset of chars from accepted_chars. This helps keep the model relatively small by ignoring punctuation, infrequenty symbols, etc.
(self, line)
| 41 | setattr(self, key, value) |
| 42 | |
| 43 | def normalize(self, line): |
| 44 | """ Return only the subset of chars from accepted_chars. |
| 45 | This helps keep the model relatively small by ignoring punctuation, |
| 46 | infrequenty symbols, etc. """ |
| 47 | return [c.lower() for c in line if c.lower() in accepted_chars] |
| 48 | |
| 49 | def ngram(self, n, l): |
| 50 | """ Return all n grams from l after normalizing """ |
no outgoing calls