parser.py 文件源码

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

项目:fTerm 作者: fTerm 项目源码 文件源码
def parse(word):
    """Interpret word as a fTerm word."""
    if word in synonyms.values():
        return word
    elif word in synonyms:
        return synonyms[word]
    else:
        lookup = get_close_matches(word, verbs.keys() + synonyms.keys())
        if len(lookup) == 0:
            # there aren't any reasonable matches
            raise KeyError
        else:
            if lookup[0] in synonyms:
                return synonyms[lookup[0]]
            else:
                return lookup[0]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号