NLTK:Resource punkt not found. Please use the NLTK Downloader to obtain the resource

NLTK可以干啥

NLTK是Python自然语言处理的工具包!网上有很多文档啦!
列几个链接叭!
NLTK详细功能介绍
…………………………hhhh更新ing

提示Resource punkt not found

因为作业需要,就用了NLTK里面的分词(word_tokenize()),还有提取词干(PorterStemmer()),但是在用分词的时候(英文分词),就遇到了这个问题:

NLTK:Resource punkt not found. Please use the NLTK Downloader to obtain the resource
参考了这位博主的博客——靠!过程简直一模一样!可惜!依然没有拯救到我(哭!)
[En]

Refer to this blogger’s blog-shit! The process is exactly the same! unfortunately! Still didn’t save me (cry! )

Resource punkt not found.&&nltk.download()下载失败

网上找到的绝大多数的解决办法:
NLTK:Resource punkt not found. Please use the NLTK Downloader to obtain the resource

由于我用nlk.download()下载不行——(为什么不行啊???我还得研究一下……),就想着去直接下载nltk_data,然后放到图片那个错误提示的任意一个文件夹下面:

  • 官网地址nltk_data
  • 在一个博主下面找的gitee下载地址nltk_data(噢!蛮快的哈哈哈哈哈哈)
    下载以后,解压,我以为把解压后的文件夹nltk_data放在上面随便一个目录下就可以了???结果是依然不行……然后我就发现文件目录是这样的:
    NLTK:Resource punkt not found. Please use the NLTK Downloader to obtain the resource
    错误提示是这样的:
    NLTK:Resource punkt not found. Please use the NLTK Downloader to obtain the resource
    大概就是希望在那几个目录下 xxxxx/nltk_data按照这个路径查找—— tokenizers/punkt/english.pickle
    但是上面的文件夹,找到tokenizers/punkt(tokenizers在packages下),punkt只有一个压缩包:
    NLTK:Resource punkt not found. Please use the NLTK Downloader to obtain the resource
    把punkt解压,然后查看是否有english.pickle文件,(这个时候可以把punkt压缩包删除了,似乎不删除也可以):
    NLTK:Resource punkt not found. Please use the NLTK Downloader to obtain the resource

最后,还需要把tokenizers文件夹放到nltk_data下面,最后文件目录这样的:

NLTK:Resource punkt not found. Please use the NLTK Downloader to obtain the resource
然后我把它放在了上面的一个路径下:
NLTK:Resource punkt not found. Please use the NLTK Downloader to obtain the resource
现在,就能按照这个路径搜索了(…/xxxxx/nltk_data/tokenizers/punkt/english.pickle),emmm总结重点就是 punkt文件夹记得解压(哭……),可能没人比我更憨了!

Original: https://blog.csdn.net/massive_jiang/article/details/116432568
Author: PleaseBrave
Title: NLTK:Resource punkt not found. Please use the NLTK Downloader to obtain the resource

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/80293/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

最近整理资源【免费获取】:   👉 程序员最新必读书单  | 👏 互联网各方向面试题下载 | ✌️计算机核心资源汇总