Running the project gives the following error:
[nltk_data] Error loading stopwords: <urlopen error [Errno 11004]
[nltk_data] getaddrinfo failed>
[nltk_data] Error loading averaged_perceptron_tagger: <urlopen error
[nltk_data] [Errno 11004] getaddrinfo failed>
The workaround is as follows:
Go to the address: https://github.com/nltk/nltk_data
Enter the directory /packages/corpora/
to find the corresponding file stopwords.zip
and put it under the corresponding file folder.
It is recommended to download the entire nltk_data
project with a size of 695M
, to avoid the situation that other problems cannot be downloaded!
Extract compressed file
nltk_data-gh-pages.zip\nltk_data-gh-pages\packages
All files into the following directory
C:\Users\Administrator\AppData\Roaming\nltk_data
The directory installed by everyone here may be different. Here is the directory above.
Modify the corresponding file:
\venv\Lib\site-packages\chatterbot\utils.py in the current project directory
(Some people's directories may not be under the current project, you can find the corresponding site-packages
directory according to your own configuration and then find the corresponding files to modify)
The corresponding code nltk_download_corpus('xxx')
needs to be modified as follows:
def download_nltk_stopwords():
"""
Download required NLTK stopwords corpus if it has not already been downloaded.
"""
nltk_download_corpus('corpora/stopwords')
def download_nltk_wordnet():
"""
Download required NLTK corpora if they have not already been downloaded.
"""
nltk_download_corpus('corpora/wordnet')
def download_nltk_averaged_perceptron_tagger():
"""
Download the NLTK averaged perceptron tagger that is required for this algorithm
to run only if the corpora has not already been downloaded.
"""
nltk_download_corpus('taggers/averaged_perceptron_tagger')
def download_nltk_vader_lexicon():
"""
Download the NLTK vader lexicon for sentiment analysis
that is required for this algorithm to run.
"""
nltk_download_corpus('sentiment/vader_lexicon')
I wish you a smooth solution to the problem