nltk 报错[nltk_data] Error loading stopwords: hostname

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')

你可能感兴趣的:(机器学习,NLP)