evaluate.py 文件源码

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

项目:bi-att-flow 作者: allenai 项目源码 文件源码
def normalize_answer(s):
    """Lower text and remove punctuation, articles and extra whitespace."""
    def remove_articles(text):
        return re.sub(r'\b(a|an|the)\b', ' ', text)

    def white_space_fix(text):
        return ' '.join(text.split())

    def remove_punc(text):
        exclude = set(string.punctuation)
        return ''.join(ch for ch in text if ch not in exclude)

    def lower(text):
        return text.lower()

    return white_space_fix(remove_articles(remove_punc(lower(s))))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号