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.
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.
Copyright © 2021 Jogjafile Inc.


Google Colab has
nltk v3.2.5installed, 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 runtimebutton shown in the end of the output.Now it should work!
You can double check the
nltkversion using this code:You need
v3.4or later to usenltk.lm.