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]