def posNegCount(self, tweet):
pos = 0
neg = 0
for p in list(punctuation):
tweet = tweet.replace(p, '')
tweet = tweet.lower()
words = tweet.split(' ')
word_count = len(words)
for word in words:
if word in self.positive_words:
pos = pos + 1
elif word in self.negative_words:
neg = neg + 1
return pos, neg
Sentiment Analysis.py 文件源码
python
阅读 36
收藏 0
点赞 0
评论 0
评论列表
文章目录