edit_distacne.py 文件源码

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

项目:Quora-Kaggle 作者: PPshrimpGo 项目源码 文件源码
def get_features(df_features):
    print('z_dist')
    now = datetime.datetime.now()
    print now.strftime('%Y-%m-%d %H:%M:%S') 
    df_features['z_dist'] = df_features.apply(lambda x:Levenshtein.ratio(x['question1'], x['question2']), axis=1)
    now = datetime.datetime.now()
    print('z_tfidf_cos_sim')
    print now.strftime('%Y-%m-%d %H:%M:%S') 
    df_features['z_tfidf_cos_sim'] = df_features.apply(lambda x: cos_sim(x['question1'], x['question2']), axis=1)
    now = datetime.datetime.now()
    print('z_w2v')
    print now.strftime('%Y-%m-%d %H:%M:%S') 
    df_features['z_w2v'] = df_features.apply(lambda x: w2v_cos_sim(x['question1'], x['question2']), axis=1)
    return df_features
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号