当前位置:   article > 正文

NLTK入门学习笔记_nltk punkt是什么

nltk punkt是什么

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

待续。。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/木道寻08/article/detail/991398
推荐阅读
相关标签
  

闽ICP备14008679号