赞
踩
运行项目出现如下错误:
- [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>
解决方法如下:
前往地址:https://github.com/nltk/nltk_data
进入目录/packages/corpora/找到对应的文件stopwords.zip放到对应的文件之下
推荐整个nltk_data项目都下载695M大小,避免了其他问题无法下载的情况!
提取压缩文件
nltk_data-gh-pages.zip\nltk_data-gh-pages\packages
所有文件到以下目录中
C:\Users\Administrator\AppData\Roaming\nltk_data
这里每个人安装的目录可能会不一样,我这里是上面的目录,
修改对应文件:
当前项目目录下\venv\Lib\site-packages\chatterbot\utils.py
(有些童鞋的目录可能不在当前项目之下,可根据自己的配置找到对应的site-packages目录然后找到对应的文件进行修改)
需修改对应代码nltk_download_corpus('xxx')如下:
-
- 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')
愿你顺利解决问题
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。