使用nltk.data.load加载english.pickle失败 [英] Failed loading english.pickle with nltk.data.load

查看:658
本文介绍了使用nltk.data.load加载english.pickle失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试加载punkt标记生成器时...

When trying to load the punkt tokenizer...

import nltk.data
tokenizer = nltk.data.load('nltk:tokenizers/punkt/english.pickle')

...提出了LookupError:

> LookupError: 
>     *********************************************************************   
> Resource 'tokenizers/punkt/english.pickle' not found.  Please use the NLTK Downloader to obtain the resource: nltk.download().   Searched in:
>         - 'C:\\Users\\Martinos/nltk_data'
>         - 'C:\\nltk_data'
>         - 'D:\\nltk_data'
>         - 'E:\\nltk_data'
>         - 'E:\\Python26\\nltk_data'
>         - 'E:\\Python26\\lib\\nltk_data'
>         - 'C:\\Users\\Martinos\\AppData\\Roaming\\nltk_data'
>     **********************************************************************

推荐答案

我遇到了同样的问题.进入python shell并输入:

I had this same problem. Go into a python shell and type:

>>> import nltk
>>> nltk.download()

然后会出现一个安装窗口.转到模型"标签,然后从标识符"列下选择"punkt".然后单击下载,它将安装必要的文件.然后应该可以了!

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!

这篇关于使用nltk.data.load加载english.pickle失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆