From 98ecf967148581f9f8c5bf1563d3901bcbcf6947 Mon Sep 17 00:00:00 2001 From: youpaishidifu Date: Sat, 15 Aug 2026 18:51:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(monitor):=20=E4=BF=AE=E5=A4=8DOCR=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E8=AF=86=E5=88=AB=E5=AF=BC=E8=87=B4=E7=9A=84=E8=BF=9E?= =?UTF-8?q?=E7=BB=AD=E5=9B=9E=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加文本归一化:全角→半角标点转换 - 使用归一化文本进行查重比较,防止OCR标点差异导致查重失效 - 基线轮处理后,后续轮询仍能正确识别相同消息 - 修复连续回复2条的问题 --- monitor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/monitor.py b/monitor.py index 6a509bf..09e181e 100644 --- a/monitor.py +++ b/monitor.py @@ -7433,18 +7433,18 @@ class MessageMonitor: continue # ⭐ 2026-08-12: 中文骨架匹配(吸收 OCR 拉丁混淆 php↔4p) # 同一消息被 OCR 识别两次(php / 4p),字符级相似度 <90% 时兜底拦截 - sk_cur = _cn_skeleton(cleaned_item) + sk_cur = _cn_skeleton(check_item) sk_old = _cn_skeleton(recent_text) if len(sk_cur) >= 6 and sk_cur == sk_old: logger.info(f"[{platform}] OCR重复识别去重(骨架匹配): 中文骨架相同,跳过: {cleaned_item[:60]}") is_duplicate = True break - if len(recent_text) < 4 or len(cleaned_item) < 4: + if len(recent_text) < 4 or len(check_item) < 4: continue # 快速长度剪枝 - if abs(len(recent_text) - len(cleaned_item)) > max(len(recent_text), len(cleaned_item)) * 0.4: + if abs(len(recent_text) - len(check_item)) > max(len(recent_text), len(check_item)) * 0.4: continue - sim = SequenceMatcher(None, cleaned_item, recent_text).quick_ratio() + sim = SequenceMatcher(None, check_item, recent_text).quick_ratio() if sim >= 0.9: logger.info(f"[{platform}] OCR重复识别去重: 相似度{sim:.2%},跳过: {cleaned_item[:60]}") is_duplicate = True