英文:
Name 'stopwords' is not defined but I already import the package
问题
NameError: name 'stopwords' is not defined
这是我的代码:
import nltk
import re
nltk.download('stopwords')
print(stopwords.words('english'))
拥有停用词列表。
英文:
I am trying to use stopwords, but I am getting this error:
NameError: name 'stopwords' is not defined
This is my code:
import nltk
import re
nltk.download('stopwords')
print(stopwords.words('english'))
Have the list of stopwords.
答案1
得分: 1
import nltk
from nltk.corpus import stopwords
stops = set(stopwords.words('english'))
print(stops)
英文:
import nltk
from nltk.corpus import stopwords
stops = set(stopwords.words('english'))
print(stops)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论