Python nltk的下载和download_shell都在punkt尝试时冻结(挂起)
使用NLTK 2.0.4.已为EPD的Python-2.7.3(不是 Canopy)安装.在Ubuntu 12.10上.在终端中输入:
Using NLTK 2.0.4. installed for EPD's Python-2.7.3 (not Canopy). on Ubuntu 12.10. In the terminal I type:
In [96]: nltk.download_shell()
NLTK Downloader
---------------------------------------------------------------------------
d) Download l) List u) Update c) Config h) Help q) Quit
---------------------------------------------------------------------------
Downloader> d
Download which package (l=list; x=cancel)?
Identifier> punkt
Downloading package 'punkt' to /home/espears/nltk_data...
然后冻结.相关的punkt.zip文件被写入指定的目录,但是download
接口从不放弃.
And then it freezes. The relevant punkt.zip file is written to the stated directory, but the download
interface never relinquishes.
此示例是在IPython上进行的,但是我使用常规的Python 2.7.3解释器进行了相同的尝试,并获得了相同的结果.
This example is with IPython, but I tried the same with the regular Python 2.7.3 interpreter and got the same result.
当我尝试使用unzip
直接解压缩文件时,我看到错误消息,指出在文件中找不到正确的中央zip代码,并且无法解压缩.见下文:
When I try to use unzip
to unzip the file directly, I see errors saying that the proper central zip-file code is not found within the file and that it cannot be unzipped. See below:
espears@computer ~/nltk_data/tokenizers $ unzip punkt.zip
Archive: punkt.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of punkt.zip or
punkt.zip.zip, and cannot find punkt.zip.ZIP, period.
nltk.download()
和nltk.download_shell()
都以相同的方式发生.
This happens with both nltk.download()
and nltk.download_shell()
in the same way.
我可以使用du
检查.zip文件,以查看其初始大小从0 MB增长到大约2.7 MB,因此它实际上正在下载内容,并且文件不为空.但是它停止为2.7 MB(可能与文件的预期完整大小相对应),然后Python Shell下载程序冻结.
I can inspect the .zip file using du
to see that initially its size grows from 0 MB to about 2.7 MB, so it is actually downloading something and the file is not empty. But it stops at 2.7 MB (which may or may not correspond to the expected full size of the file) and then the Python shell downloader freezes.
我遇到了同样的问题,并从以下链接手动下载了必要的项目:
I had the same problem and downloaded the necessary items manually from the following link:
不是所需的解决方案,但在此问题解决之前将一直有效.
Not the desired solution, but will work until this is fixed.
更新:
我实际上能够运行nltk.download()来安装cmudict.也许这个问题只影响某些软件包?
I was actually able to run nltk.download() to install cmudict. Maybe this issue only affects certain packages?