简体   繁体   English

使用 TextBlob 时添加停用词

[英]Adding Stopwords while Using TextBlob

For a sentiment analysis project, I'm trying to add stopwords while using TextBlob.对于情绪分析项目,我正在尝试在使用 TextBlob 时添加停用词。 I've tried to combine NTLK scripts as well with no luck.我也尝试过结合 NTLK 脚本,但没有运气。 Here is my code prior to attempting to add the stopwords.这是我在尝试添加停用词之前的代码。

import csv
from textblob import TextBlob

infile = 'File Path'

with open(infile, 'r') as csvfile:
    rows = csv.reader(csvfile)
    for row in rows:
        sentence = row[0]
        blob = TextBlob(sentence)        
        print (blob.sentiment_assessments)

Possible duplicate of Adding words to nltk stoplist 将单词添加到 nltk 停止列表的可能重复项

However, if it was a typo and you actually wanted to remove the stopwords, still a possible duplicate of Stopword removal with NLTK and Removing stopwords from a textblob Moreover, you should look into the following issue mentioned under the issues sections of the developer of textblob: https://github.com/sloria/TextBlob/issues/153但是,如果它是一个错字并且您实际上想要删除停用词,则仍然可能与使用 NLTK 删除停用词和从 textblob中删除停用词重复,此外,您应该查看 textblob 开发人员的问题部分中提到的以下问题: https://github.com/sloria/TextBlob/issues/153

But, if still it's not clear to you, please elaborate the exact issue with sample code.但是,如果您仍然不清楚,请使用示例代码详细说明确切的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM