semantic.py 文件源码

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

项目:chat 作者: Decalogue 项目源码 文件源码
def get_tag(sentence, config):
    """
    Get semantic tag of sentence.
    """
    iquestion = sentence.format(**config)
    try:
        keywords = analyse.extract_tags(iquestion, topK=1)
        keyword = keywords[0]
    except IndexError:
        keyword = iquestion
    tags = synonym_cut(keyword, 'wf') # tuple list
    if tags:
        tag = tags[0][1]
        if not tag:
            tag = keyword
    else:
        tag = keyword
    return tag
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号