Sentiment Analysis.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:Twitter-Sentiment-Analysis-For-Birthday-Celebrities 作者: vishal-tiwari 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号