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: