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!"
评论列表
文章目录