weasel_words.py 文件源码

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

项目:thesis-check 作者: albalitz 项目源码 文件源码
def analyze(line, linenum, lang):
    annotations = []

    if lang is Language.en_EN or lang is None:
        weasel_words = WEASEL_WORDS_EN
    elif lang is Language.de_DE:
        weasel_words = WEASEL_WORDS_DE

    for weasel_pattern in weasel_words:
        for match in re.finditer(weasel_pattern, line, flags=re.IGNORECASE):
            if (not verify_match(match, line)) or (not matches_whole_words(match, line)):
                continue

            index = match.start()
            annotation = WeaselWord(linenum, line, index, word=match.group(0))
            annotations.append(annotation)

    return annotations
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号