赞
踩
参考http://hao.jobbole.com/nltk/ 作为自己的NLTK的入门篇,演练其代码,记录代码执行过程中的一些问题,以及应对方法;
Anaconda2\python.exe(上机环境)
1.刚调用nltk的word_tokenize就raise一个如下Error
LookupError:
Resource u’tokenizers/punkt/english.pickle’ not found. Please
use the NLTK Downloader to obtain the resource: >>>
nltk.download()
解决办法:
I had this same problem. Go into a python shell and type:
import nltk
nltk.download()
Then an installation window appears. Go to the ‘Models’ tab and select ‘punkt’ from under the ‘Identifier’ column. Then click Download and it will install the necessary files. Then it should work!
下载完punkt之后,word_tokenize可以分词成功了,但是执行pos_tag又报出找不到数据的错误,于是按照上面的步骤下载有Tagger字样的Model;
这类的问题好解决,也就是在使用nltk时,遇到什么报错就参考上面的步骤下载对应的包。
待续。。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。