From 0b452f975a750e72a100a4ad5d614a0474dd5d39 Mon Sep 17 00:00:00 2001 From: Dom Date: Tue, 21 Apr 2026 16:49:22 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20p=C3=A9naliser=20matchs=20OCR=20partiels?= =?UTF-8?q?=20trop=20courts=20(demo=20dans=20CR=5Fpatient=5Fdemo)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- core/execution/input_handler.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/execution/input_handler.py b/core/execution/input_handler.py index b94e9503a..66ef6d0f7 100644 --- a/core/execution/input_handler.py +++ b/core/execution/input_handler.py @@ -484,7 +484,10 @@ def _grounding_ocr(target_text: str, anchor_bbox: Optional[Dict] = None) -> Opti all_matches.append({'text': word['text'], 'x': cx, 'y': cy, 'type': 'exact', 'conf': 0.95}) elif len(word_lower) >= 3 and len(target_lower) >= 3: if target_lower in word_lower or word_lower in target_lower: - all_matches.append({'text': word['text'], 'x': cx, 'y': cy, 'type': 'partial', 'conf': 0.80}) + # Pénaliser les matchs partiels trop courts par rapport au target + ratio = len(word_lower) / max(len(target_lower), 1) + conf = 0.80 if ratio > 0.5 else 0.50 + all_matches.append({'text': word['text'], 'x': cx, 'y': cy, 'type': 'partial', 'conf': conf}) # Matching lettre initiale manquante if not all_matches and len(target_lower) > 3: