0

The N-gram model provides the probability of next word P(W) by seeing the history. (as per window size). How can I implement this in python using nltk?

Is there any pre-built package for the same?

I referred to this question.. However I am not able to import Ngram model. It gives me error as,

NameError: name 'NgramModel' is not defined

How can I solve this problem?

Edit - It seems that the NgramModel has been removed due to some bugs. Refer this. So which alternate model can be used?

Community
  • 1
  • 1
Riken Shah
  • 3,022
  • 5
  • 29
  • 56

0 Answers0