From 60c4138660d7651ce63728a20fbcfae5621852f7 Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Mon, 9 Mar 2026 15:12:02 +0100 Subject: [PATCH] fix: _MIN_WORD_CONF als Modul-Konstante statt lokale Variable NameError in build_cell_grid_v2 weil _MIN_WORD_CONF nur in _ocr_cell_crop und build_cell_grid lokal definiert war. Co-Authored-By: Claude Opus 4.6 --- klausur-service/backend/cv_cell_grid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/klausur-service/backend/cv_cell_grid.py b/klausur-service/backend/cv_cell_grid.py index 6e55509..6480884 100644 --- a/klausur-service/backend/cv_cell_grid.py +++ b/klausur-service/backend/cv_cell_grid.py @@ -39,6 +39,8 @@ try: except ImportError: Image = None # type: ignore[assignment,misc] +# Minimum OCR word confidence to keep (used across multiple functions) +_MIN_WORD_CONF = 30 # --------------------------------------------------------------------------- @@ -186,7 +188,6 @@ def _ocr_cell_crop( words = [] # Filter low-confidence words - _MIN_WORD_CONF = 30 if words: words = [w for w in words if w.get('conf', 0) >= _MIN_WORD_CONF] @@ -652,7 +653,6 @@ def _ocr_single_cell( # Filter low-confidence words (OCR noise from images/artifacts). # Tesseract gives low confidence to misread image edges, borders, # and other non-text elements. - _MIN_WORD_CONF = 30 if words: words = [w for w in words if w.get('conf', 0) >= _MIN_WORD_CONF]