Score trigram

Report a typo

Take a tokenized version of Shakespeare's Hamlet from the NLTK corpus:

import nltk
nltk.download('gutenberg')
from nltk.corpus import gutenberg

hamlet = gutenberg.words('shakespeare-hamlet.txt')

Preporcess the text by filtering words shorter than three letters and words that are marked as stopwords. Find the score of a trigram ('primall', 'eldest', 'curse') using likelihood_ratio. Do not round the result, it should be the exact score of the trigram.

Enter a number

Create a free account to access the full topic