def getVec(kb, id1, id2):
if kb == 'bh':
title1, context1, category1 = getMsgbyId('baidu', id1)
title2, context2, category2 = getMsgbyId('hudong', id2)
if kb == 'bw':
title1, context1, category1 = getMsgbyId('baidu', id1)
title2, context2, category2 = getMsgbyId('wiki', id2)
if kb == 'hw':
title1, context1, category1 = getMsgbyId('hudong', id1)
title2, context2, category2 = getMsgbyId('wiki', id2)
title_r = Levenshtein.ratio(title1, title2)
context_r = cosine(context1, context2)
category_r = sameCategory(category1, category2)
return (title_r, context_r, category_r, 0.0)
评论列表
文章目录