【发布时间】:2017-11-28 20:00:10
【问题描述】:
我一直在尝试对电影评论数据集执行情感分析,但我陷入了无法从数据中删除英语停用词的地步。我做错了什么?
from nltk.corpus import stopwords
stop = stopwords.words("English")
list_ = []
for file_ in dataset:
dataset['Content'] = dataset['Content'].apply(lambda x: [item for item in x.split(',') if item not in stop])
list_.append(dataset)
dataset = pd.concat(list_, ignore_index=True)
【问题讨论】:
-
你得到的
error是什么? -
@open-source 没有错误 - 我执行此代码时没有任何反应。
-
您的内容是
'i, am, the, computer, machine.'格式的吗?您可以发布一条您希望从中删除停用词的行吗? -
可能这就是你需要的github.com/alvations/earthy/blob/master/… =)
标签: python pandas nltk sentiment-analysis stop-words