Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nltk NgramModel error

Tags:

python

nltk

I've previously used the NgramModel class in nltk without error. However, I recently updated nltk to version 3.1 and I can no longer find the NgramModel class. When I try to import as usual:

from nltk.model import NgramModel

I get the error

ImportError: No module named 'nltk.model'.

Has NgramModel or the model module been recently replaced?

like image 295
istewart Avatar asked Jan 06 '16 18:01

istewart


1 Answers

This is an open issue because of bugs.

This is noted in the issue:

If you're currently using the version from github, you can switch to the "model" branch, which includes the NgramModel code, though it's currently significantly behind the "develop" branch and hasn't picked up all the newest bug fixes.

The link to the model branch is here.

like image 189
erip Avatar answered Sep 19 '22 10:09

erip