search.py 文件源码

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

项目:Twitter-Sentiment-Analysis 作者: crakama 项目源码 文件源码
def sentimentanalysis(self, text_):
        """
           Does sentiment analysis using SQLAlchemy API
        """
        alchemyapi = AlchemyAPI()
        # import ipdb; ipdb.set_trace()
        if "" in text_.keys() and len(text_) < 2:

            print "No tweets to analyse were found!!"
        else:
            response = alchemyapi.sentiment("text", text_)
            sentrep = response["docSentiment"]["type"]
            lst = [sentrep]

        prettytable = PrettyTable(['Sentiment Type'])

        t = prettytable.add_row(lst) 

        print prettytable
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号