diff --git a/klausur-service/backend/grid_editor_api.py b/klausur-service/backend/grid_editor_api.py index e34843e..ff8722a 100644 --- a/klausur-service/backend/grid_editor_api.py +++ b/klausur-service/backend/grid_editor_api.py @@ -21,6 +21,7 @@ from fastapi import APIRouter, HTTPException, Request from cv_box_detect import detect_boxes, split_page_into_zones from cv_color_detect import detect_word_colors, recover_colored_text +from cv_ocr_engines import fix_cell_phonetics from cv_words_first import _cluster_rows, _build_cells from ocr_pipeline_session_store import ( get_session_db, @@ -970,6 +971,11 @@ async def build_grid(session_id: str): if ")" in text and "(" not in text: cell["text"] = "(" + text + # 5c. IPA phonetic correction — replace garbled OCR phonetics with + # correct IPA from the dictionary (same as in the OCR pipeline). + all_cells = [cell for z in zones_data for cell in z.get("cells", [])] + fix_cell_phonetics(all_cells, pronunciation="british") + duration = time.time() - t0 # 6. Build result