(corpus)
| 40 | |
| 41 | |
| 42 | def vocab(corpus): |
| 43 | # Create a vocabulary list from the corpus |
| 44 | voc_list = [] |
| 45 | for sentence in corpus: |
| 46 | for word in sentence: |
| 47 | voc_list.append(word) |
| 48 | return Vocabulary(voc_list, unk_cutoff=3) |
| 49 | |
| 50 | |
| 51 | def prediction(train, prefix): |