From 1f7989cfc230e89a7e43efc5b664bb1bb13559a3 Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Fri, 20 Mar 2026 11:45:35 +0100 Subject: [PATCH] Fix grammar bracket detection: split on spaces too, not just slashes _is_grammar_bracket_content now splits "no pl" into ["no", "pl"] instead of treating it as single token "no pl". Co-Authored-By: Claude Opus 4.6 --- klausur-service/backend/cv_ocr_engines.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/klausur-service/backend/cv_ocr_engines.py b/klausur-service/backend/cv_ocr_engines.py index 4a4dd4f..0e96432 100644 --- a/klausur-service/backend/cv_ocr_engines.py +++ b/klausur-service/backend/cv_ocr_engines.py @@ -907,8 +907,9 @@ def _is_grammar_bracket_content(content: str) -> bool: if not content: return False - # Split on / for patterns like (about/of), (on/with) - tokens = [t.strip().lower() for t in content.split('/') if t.strip()] + # Split on / and spaces for patterns like (about/of), (no pl) + tokens = re.split(r'[/\s]+', content.strip().lower()) + tokens = [t for t in tokens if t] if not tokens: return False