diff --git a/klausur-service/backend/grid_build_core.py b/klausur-service/backend/grid_build_core.py index cab5277..037c578 100644 --- a/klausur-service/backend/grid_build_core.py +++ b/klausur-service/backend/grid_build_core.py @@ -1112,6 +1112,13 @@ async def _build_grid_core( # Has real IPA symbols → already fixed or valid if any(c in _REAL_IPA_CHARS for c in cell_text): continue + # Guard: if text contains multiple real words, it's + # normal text (e.g. "Betonung auf der 1. Silbe: + # profit"), not garbled IPA. Garbled IPA is + # typically short and has no recognizable words. + _words_in_text = re.findall(r'[A-Za-zÄÖÜäöüß]{3,}', cell_text) + if len(_words_in_text) >= 3: + continue # Find headword in previous row, same column prev_ri = rows_sorted[idx - 1]["index"]