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
评论列表
文章目录