feat: 避免段落空格影响检测结果

This commit is contained in:
raiot 2023-08-24 20:06:54 +08:00
parent 1ddb4e83dd
commit 0ee978ba4e
1 changed files with 1 additions and 0 deletions

View File

@ -29,6 +29,7 @@ def docx_find(file_path: str, keyword_list: list) -> dict:
paragraph_keyword = []
for para in doc_text.split('\n'):
para = re.sub(r'\s+', '', para) # 删除段落中空格
this_para_keyword = [keyword for keyword in keyword_list if keyword in para] # 查找该段落中的敏感词
if this_para_keyword: