How to Solve NameError: name 'ngrams' is not defined -- nltk

Solution: Import the 'ngrams' module

To Solve the error, add the following line to the top of your code.

from nltk import ngrams

 

For more information:
Python nltk ngrams