Resource punkt not found. Please use the NLTK Downloader to obtain the resource错误解决方案

简介: Resource punkt not found. Please use the NLTK Downloader to obtain the resource错误解决方案

一、首先前提是已经安装了python的nltk库(见下图),目的是调用nltk库的word_tokenize方法实现英文分词

二、在运行word_tokenize方法代码中报“Resource punkt not found. Please use the NLTK Downloader to obtain the resource”错误(见下图),翻译成中文是“找不到资源。请使用NLTK下载程序获取资源”,官方也已经明显提示我们怎么去解决这个问题。

三、在 jupyter notebook 中复制粘贴运行下面的代码,目的是打开NLTK下载资源的网页进行下载程序获取资源(见下面第二张图)。

import nltk
nltk.download()

四、成功打开页面后,首先选择点击“Models”,然后找到点击选择“punkt”模型,最后点击“Download”进行模型下载,下载需要等待十秒即可。

五、重新运行源程序的代码没有再报同样的错误就成功解决这个问题了。


相关文章
|
6天前
|
Android开发
【Bug】Android resource linking failed和error: failed linking references.
【Bug】Android resource linking failed和error: failed linking references.
|
6天前
|
安全 Java API
Eclipse 打开marketplace 报PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
网上有很多解决的帖子,我这里只是记录一下方便自己查阅 主要原因是java本身需要证书 1、按导入安全证书的方法解决
345 0
Eclipse 打开marketplace 报PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
|
JSON Java 数据格式
springboot后台下载文件报错: Could not find acceptable representation
使用springboot实现从服务器下载文件功能时,报错:Could not find acceptable representation
1188 0
|
Java
Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.
Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.
907 0
Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.
|
7月前
|
开发者
上传苹果版本时错误解决办法:No suitable application records were found. Verify your bundle identifier
上传苹果版本时错误解决办法:No suitable application records were found. Verify your bundle identifier
63 2
|
9月前
|
前端开发 数据库
Failed to load response dataNo data found for resource with given identifier
Failed to load response dataNo data found for resource with given identifier
1082 0
No matching configuration of project :libusb was found.
No matching configuration of project :libusb was found.
465 0
|
数据安全/隐私保护
导入 Walle 时报:ERROR: A problem occurred configuring project ':app'.
导入 Walle 时报:ERROR: A problem occurred configuring project ':app'.
导入 Walle 时报:ERROR: A problem occurred configuring project ':app'.
|
Linux
Error: automake: Failed to download resource “m4“
Error: automake: Failed to download resource “m4“
219 0
|
测试技术
Appium问题解决方案(5)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session
Appium问题解决方案(5)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session
427 0
Appium问题解决方案(5)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session