While running a Python script using NLTK I got this:
Traceback (most recent call last):
File \"cpicklesave.py\", line 56, in
pos = nltk.
If you have not downloaded ntlk then firstly download ntlk and then use this nltk.download('punkt')
it will give you the result.
You can download NLTK missing module just by
import nltk
nltk.download()
This will shows the NLTK download screen. If it shows SSL Certificate verify failed error. Then it should works by disabling SSL check with below code!
import nltk
import ssl
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
pass
else:
ssl._create_default_https_context = _create_unverified_https_context
nltk.download()
Problem: Lookup error when extracting count vectorizer from scikit learn. Below is code snippet.
from sklearn.feature_extraction.text import CountVectorizer
bow_transformer = CountVectorizer(analyzer=text_process).fit(X)
Solution: Try to run the below code and then try to install the stopwords from corpora natural language processing toolkit!!
import nltk
nltk.download()
TL;DR
import nltk
nltk.download('averaged_perceptron_tagger')
Or to download all packages + data + docs:
import nltk
nltk.download('all')
See How do I download NLTK data?
Use
>>> nltk.download()
to install the missing module (the Perceptron Tagger).
(check also the answers to Failed loading english.pickle with nltk.data.load)
First answer said the missing module is 'the Perceptron Tagger', actually its name in nltk.download is 'averaged_perceptron_tagger'
You can use this to fix the error
nltk.download('averaged_perceptron_tagger')