赞
踩
Please use the NLTK Downloader to obtain the resource
LookupError:
Resource punkt not found.
Please use the NLTK Downloader to obtain the resource:
图片:
地址:https://github.com/nltk/nltk_data
注意 : 文件夹的名一定要是 nltk_data
本人将 nltk_data 文件放到了:
import nltk
from nltk.book import *
显示下图;说明正常
import nltk
nltk.word_tokenize("A pivot is the pin or the central point on which something balances or turns")
如果出现下图这种情况
我们需要将 tokenizers 中的 punkt.zip 解压,并且放到 本路径下,如图
重新进行测试:
import nltk
nltk.word_tokenize("A pivot is the pin or the central point on which something balances or turns")
出现下图情况,说明nltk模块可以正常使用
同样的可以使用其他的 nltk_data 数据集,比如解决:出现没有 reuters 数据的问题!!
from nltk.book import *
from nltk.corpus import reuters
files = reuters.fileids()
print(files)
https://blog.csdn.net/qq_35164554/article/details/112669384
内有链接,可以高速下载
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。