简体   繁体   English

无法在Mac OS X 10.10的虚拟环境中下载nltk语料库

[英]Fail to download the nltk corpus in a virtual environment in the mac os x 10.10

I tried to install the nltk corpus (actually what I need temporarily is vader.text ) but I got such an error: 我试图安装nltk语料库(实际上我临时需要的是vader.text ),但是出现了这样的错误:

Error downloading 'panlex_lite' from
[nltk_data]    |     <https://raw.githubusercontent.com/nltk/nltk_data
[nltk_data]    |     /gh-pages/packages/corpora/panlex_lite.zip>:
[nltk_data]    |     HTTP Error 404: Not Found

I tried both nltk installer and command line way. 我尝试了nltk安装程序和命令行方式。 Why does this happen and how can I solve this? 为什么会发生这种情况,我该如何解决? Thanks. 谢谢。

EDIT: I tried this solution but it doesn't work for me. 编辑:我尝试了此解决方案,但它对我不起作用。

I came across this issue & would like to share how I resolved it: 我遇到了这个问题,并想分享我的解决方法:

Step 1) When downloading vader_lexicon by nltk.download() which opens the NLTK Downloader, the file is downloaded as a zip. 步骤1)当通过打开NLTK Downloader的nltk.download()下载vader_lexicon时,该文件将以zip格式下载。 Seeing that the error message says that the .txt file is not available, I decided to unzip the file. 看到错误消息说.txt文件不可用,我决定解压缩该文件。

Step 2) I compared the file location to the pathway indicated by the error message. 步骤2)我将文件位置与错误消息指示的路径进行了比较。 - My vader_lexicon.txt file was in .../nltk_data/sentiment/vader_lexicon/vader_lexicon.txt . -我的vader_lexicon.txt文件位于.../nltk_data/sentiment/vader_lexicon/vader_lexicon.txt - Whereas apparently it was needed at .../lib/python3.5/site-packages/nltk/sentime‌​nt/vader_lexicon.txt‌​ . -而显然它需要在.../lib/python3.5/site-packages/nltk/sentime‌​nt/vader_lexicon.txt‌​

Instead of configuring paths, I went with "brute force" and decided to move the .txt file to the right place. 我没有配置路径,而是使用了“蛮力”,决定将.txt文件移动到正确的位置。 Problem solved. 问题解决了。

(Python 2.7, nltk 3.1, Mac) (Python 2.7,nltk 3.1,Mac)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM