Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
LookupError:
**********************************************************************
Resource 'corpora/stopwords' not found. Please use the NLTK
Downloader to obtain the resource: >>> nltk.download()
So therefore I open my python termin and did the following:
import nltk
nltk.download()
Which gives me:
showing info https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/index.xml
However this does not seem to stop. And running it again still gives me the same error. Any thoughts where this goes wrong?
You are currently trying to download every item in nltk data, so this can take long. You can try downloading only the stopwords that you need:
import nltk
nltk.download('stopwords')
Or from command line (thanks to Rafael Valero's answer):
python -m nltk.downloader stopwords
if you get an SSL/Certificate error, run the following command.
This works by disabling SSL check!
import nltk
import ssl
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
else:
ssl._create_default_https_context = _create_unverified_https_context
nltk.download()
Use GPU runtime, it will not give you any error.
The same code will work which you are using
import nltk
stopwords = nltk.corpus.stopwords.words('english')
print(stopwords[:10])
I know the comment is quite late, but if it helps:
Although the nltk.download('stopwords')
will do the job, there might be times when it won't work due to proxy issues if your organization has blocked it.
I found this github link pretty handy, from where I can just pick up the list of words and integrate it manually in my project just as a workaround.
If you are running this command in a jupyter notebook, it opens another window titled 'NLTK Downloader'. Once you go in that window, you can select the topics you want to download and then click on download button to start downloading.
Until you close the NLTK Downloader window, the cell in the Jupyter keeps on running.
Error :
RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
[nltk_data] Error loading stopwords: <urlopen error [SSL:
[nltk_data] CERTIFICATE_VERIFY_FAILED] certificate verify failed:
[nltk_data] unable to get local issuer certificate (_ssl.c:1123)>
Use the solution provided my @reshma2k
nltk.download('stopwords')
it did not work. The issue was wordnet.zip was unabale to unzip on its own so simple go to folder wherepython3 -m textblob.download_corpora
this command installed package and unzip folder
cd nltk_data/corpora/
unzip stopwords.zip
nltk.download('stopwords')
from nltk.corpus import stopwords
words=stopwords.words('english')[0:20]
print(words)
–