MutiKB.py 文件源码

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

项目:entity-linker 作者: seucs 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号