NLTK入门学习笔记

来源:互联网 发布:directx 9.0修复软件 编辑:程序博客网 时间:2024/05/22 10:30

参考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时,遇到什么报错就参考上面的步骤下载对应的包。

待续。。

0 0
原创粉丝点击