First_output.py 文件源码

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

项目:stc_ntcir12_code 作者: luochuwei 项目源码 文件源码
def get_ranked_response(model, test_post_seg, candidate_list, similar_post_dic):
    test_post_seg_vec = get_sentence_vec(model, test_post_seg, candidate_list, similar_post_dic)
    for c in candidate_list:
        c_p_vec = get_sentence_vec(model, c[1], candidate_list, similar_post_dic)
        c_r_vec = get_sentence_vec(model, c[4], candidate_list, similar_post_dic)
        c[2] = c_p_vec
        c[5] = c_r_vec
        s2 = float(cosine_similarity(c_p_vec, c_r_vec))
        s3 = float(cosine_similarity(test_post_seg_vec, c_r_vec))
        c[7] = s2
        c[8] = s3
        # rank_score = 1000*c[6]*c[7]*c[8]
        rank_score = c[6]*0.5+c[7]*1.5+c[8]*2
        c[9] = rank_score
    rank_candidate = sorted(candidate_list, key = lambda l: l[-1])
    return rank_candidate
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号