nltk 报错[nltk_data] Error loading stopwords: hostname,采用下面代码下载stopwords来解决
import nltk
import ssl
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
pass
else:
ssl._create_default_https_context = _create_unverified_https_context
nltk.download('stopwords')
nltk.download('punkt')
本文介绍了一种解决NLTK库在下载stopwords时遇到的错误的方法,通过修改SSL验证方式,成功下载了停用词和分词工具,确保了自然语言处理任务的顺利进行。

2297

被折叠的 条评论
为什么被折叠?



