我在跟踪nltk book chapter 1。我可以安装nltk
(import nltk
),但无法通过运行nltk.download()
下载图书语料库。它给了我getattrinfo failed
错误。所以我开始快速浏览第章中的命令,而不执行这些命令,因为给出的大多数示例都需要图书语料库。在
但现在我想试试^{
While running ^{getattrinfo failed
错误,我尝试了各种帖子中给出的不同解决方案,这让我筋疲力尽。(我tried setting up corporate proxy,changing nltk downloader source link还有许多其他东西)
所以,我没有遵循使用nltk下载器的路线,而是尝试做一些可能奇怪的事情。我下载了zip from ^{setup.py
。在
现在,当我运行from nltk.book import *
时,我得到以下输出:
>>> from nltk.book import *
*** Introductory Examples for the NLTK Book ***
Loading text1, ..., text9 and sent1, ..., sent9
Type the name of the text or sentence to view it.
Type: 'texts()' or 'sents()' to list the materials.
Traceback (most recent call last):
File "D:\path\Softwares\python\WinPython-64bit-3.4.4.4Qt5\python-3.4.4.amd64\lib\site-packages\nltk\corpus\util.py", line 63, in __load
try: root = nltk.data.find('corpora/%s' % zip_name)
File "D:\path\Softwares\python\WinPython-64bit-3.4.4.4Qt5\python-3.4.4.amd64\lib\site-packages\nltk\data.py", line 641, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource 'corpora/gutenberg.zip/gutenberg/' not found. Please
use the NLTK Downloader to obtain the resource: >>>
nltk.download()
Searched in:
- 'C:\\Users\\593932/nltk_data'
- 'C:\\nltk_data'
- 'D:\\nltk_data'
- 'E:\\nltk_data'
- 'D:\\path\\Softwares\\python\\WinPython-64bit-3.4.4.4Qt5\\python-3.4.4.amd64\\nltk_data'
- 'D:\\path\\Softwares\\python\\WinPython-64bit-3.4.4.4Qt5\\python-3.4.4.amd64\\lib\\nltk_data'
- 'C:\\Users\\593932\\AppData\\Roaming\\nltk_data'
**********************************************************************
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\path\Softwares\python\WinPython-64bit-3.4.4.4Qt5\python-3.4.4.amd64\lib\site-packages\nltk\book.py", line 20, in <module>
text1 = Text(gutenberg.words('melville-moby_dick.txt'))
File "D:\path\Softwares\python\WinPython-64bit-3.4.4.4Qt5\python-3.4.4.amd64\lib\site-packages\nltk\corpus\util.py", line 99, in __getattr__
self.__load()
File "D:\path\Softwares\python\WinPython-64bit-3.4.4.4Qt5\python-3.4.4.amd64\lib\site-packages\nltk\corpus\util.py", line 64, in __load
except LookupError: raise e
File "D:\path\Softwares\python\WinPython-64bit-3.4.4.4Qt5\python-3.4.4.amd64\lib\site-packages\nltk\corpus\util.py", line 61, in __load
root = nltk.data.find('corpora/%s' % self.__name)
File "D:\path\Softwares\python\WinPython-64bit-3.4.4.4Qt5\python-3.4.4.amd64\lib\site-packages\nltk\data.py", line 641, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource 'corpora/gutenberg' not found. Please use the NLTK
Downloader to obtain the resource: >>> nltk.download()
Searched in:
- 'C:\\Users\\593932/nltk_data'
- 'C:\\nltk_data'
- 'D:\\nltk_data'
- 'E:\\nltk_data'
- 'D:\\path\\Softwares\\python\\WinPython-64bit-3.4.4.4Qt5\\python-3.4.4.amd64\\nltk_data'
- 'D:\\path\\Softwares\\python\\WinPython-64bit-3.4.4.4Qt5\\python-3.4.4.amd64\\lib\\nltk_data'
- 'C:\\Users\\593932\\AppData\\Roaming\\nltk_data'
**********************************************************************
>>>
我手动复制粘贴了nltk
文件夹,该文件夹还包含book.py
在上面列出的各种文件夹中:
但没用。如何从github下载的zip文件在解释器环境中导入这本书,而不需要使用nltk downloader?有可能吗?在
目前没有回答
相关问题 更多 >
编程相关推荐