[python 3求解数据框

问题描述 投票:1回答:1

试图从包含阿拉伯语句子的csv文件中删除停用词,但我不确定我有很多错误

我的代码

print(tokenized_docs_no_punctuation)
    stops = set(stopwords.words('arabic'))
    words=tokenized_docs_no_punctuation
    print([word for word in words if word not in stops])

这是错误enter image description here

任何想法或解决方案?

python pandas nltk python-3.6 stop-words
1个回答
0
投票
您收到TypeError: unhashable type: 'list'的错误表明您正在尝试对list对象进行哈希处理。根据您在问题中发布的代码,似乎set(stopwords.words('arabic'))引起了错误,因为set函数试图对参数进行哈希处理以查找重复项。查看stopwords.words('arabic')输出,并确保输出中没有list对象。
© www.soinside.com 2019 - 2024. All rights reserved.