I'm trying to import the NLTK language modeling module (nltk.lm) in a Google colaboratory notebook without success. I've tried by installing everything from nltk, still without success.
What mistake or omission could I be making?
Thanks in advance.
Google Colab has
nltk v3.2.5
installed, butnltk.lm
(Language Modeling package) was added inv3.4
.In your Google Colab run:
In the output you will see it downloads a new version, and uninstalls the old one:
Click the
Restart runtime
button shown in the end of the output.Now it should work!
You can double check the
nltk
version using this code:You need
v3.4
or later to usenltk.lm
.