源代码: https://blog.csdn.net/github_38705794/article/details/75452729
一、复现时报错:
Traceback (most recent call last):
File "D:\Program\python3\lib\site-packages\nltk\corpus\util.py", line 80, in __load
try: root = nltk.data.find('{}/{}'.format(self.subdir, zip_name))
File "D:\Program\python3\lib\site-packages\nltk\data.py", line 675, in find
raise LookupError(resource_not_found)
LookupError:
解决方法:
https://*.com/questions/26693736/nltk-and-stopwords-fail-lookuperror
You don't seem to have the stopwords corpus on your computer.
You need to start the NLTK Downloader and download all the data you need.
Open a Python console and do the following:
>>> import nltk
>>> nltk.download()
showing info http://nltk.github.com/nltk_data/
In the GUI window that opens simply press the 'Download' button to download all corpora or go to the 'Corpora' tab and only download the ones you need/want.