NLTK入门学习笔记

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

待续。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值