manage.py 文件源码

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

项目:sentiment-analysis 作者: kasheemlew 项目源码 文件源码
def get_count():
    comments = Comment.query.all()
    for comment in comments:
        for word in comment.parsed.split('/'):
            if word in pos_list:
                comment.pos_count += 1
            elif word in neg_list:
                comment.neg_count += 1
            elif '80' <= word and word <= '99':
                comment.pos_count += 1
            elif '0' <= word and word < '80':
                comment.neg_count += 1
        db.session.add(comment)
        print "Comment %04d counted!" % comment.id
    db.session.commit()
    print "ALL DONE!"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号