示例#1
0
def savetoDB(appid,comment_count,pos_count,neg_count):

    if comment_count < useful_comment_threshold:
        print("总的有效评论数量:"+str(comment_count)+" 好评数量:"+str(pos_count)+" 差评数量:"+str(neg_count))
        print("该app的评论数小于100,无参考意义")
        print()
        return

    applause_rate = (float)(pos_count / comment_count)
    top_score,lower_score = WilsonScoreUtil.confidence(pos_count,neg_count)
    print("总的有效评论数量:"+str(comment_count)+" 好评数量:"+str(pos_count)+" 差评数量:"+str(neg_count)+" 好评率:"+str(applause_rate))
    print()
    MongoUtil.save("emotion_comment",{ "appid":appid,
                                       "comment_count":comment_count,
                                       "pos_count":pos_count,
                                       "neg_count":neg_count,
                                       "applause_rate":applause_rate,
                                       "wilson_top_score" :top_score,
                                       "wilson_lower_score":lower_score
                                      })
示例#2
0
def saveAppCapacityToDB(appid, date, capacity):
    post = {"appid": appid, "date": date}
    if not MongoUtil.isExist("capacity_table", post):
        post["capacity"] = capacity
        MongoUtil.save("capacity_table", post)