diff --git a/admin-lehrer/app/(admin)/ai/ocr-pipeline/types.ts b/admin-lehrer/app/(admin)/ai/ocr-pipeline/types.ts index 1a9797e..e5d50d2 100644 --- a/admin-lehrer/app/(admin)/ai/ocr-pipeline/types.ts +++ b/admin-lehrer/app/(admin)/ai/ocr-pipeline/types.ts @@ -180,11 +180,13 @@ export interface WordEntry { english: string german: string example: string + source_page?: string confidence: number bbox: WordBbox bbox_en: WordBbox | null bbox_de: WordBbox | null bbox_ex: WordBbox | null + bbox_ref?: WordBbox | null status?: 'pending' | 'confirmed' | 'edited' | 'skipped' } diff --git a/admin-lehrer/components/ocr-pipeline/StepWordRecognition.tsx b/admin-lehrer/components/ocr-pipeline/StepWordRecognition.tsx index 0671a6b..5590201 100644 --- a/admin-lehrer/components/ocr-pipeline/StepWordRecognition.tsx +++ b/admin-lehrer/components/ocr-pipeline/StepWordRecognition.tsx @@ -518,43 +518,54 @@ export function StepWordRecognition({ sessionId, onNext, goToStep }: StepWordRec {/* Entry/Cell table */}
{isVocab ? ( - /* Vocab table: EN/DE/Example columns */ - - - - - - - - - - - - {editedEntries.map((entry, idx) => ( - { setActiveIndex(idx); setMode('labeling') }} - > - - - - - - - ))} - -
#EnglishDeutschExampleConf
{idx + 1} - - - - - - - {entry.confidence}% -
+ /* Vocab table: EN/DE/Example columns + optional page_ref */ + (() => { + const hasPageRef = editedEntries.some(e => e.source_page) + return ( + + + + + {hasPageRef && } + + + + + + + + {editedEntries.map((entry, idx) => ( + { setActiveIndex(idx); setMode('labeling') }} + > + + {hasPageRef && ( + + )} + + + + + + ))} + +
#SeiteEnglishDeutschExampleConf
{idx + 1} + {entry.source_page || ''} + + + + + + + + {entry.confidence}% +
+ ) + })() ) : ( /* Generic table: dynamic columns from columns_used */ diff --git a/klausur-service/backend/cv_vocab_pipeline.py b/klausur-service/backend/cv_vocab_pipeline.py index eb873d9..e400169 100644 --- a/klausur-service/backend/cv_vocab_pipeline.py +++ b/klausur-service/backend/cv_vocab_pipeline.py @@ -4215,12 +4215,14 @@ def _cells_to_vocab_entries( 'column_de': 'german', 'column_example': 'example', 'page_ref': 'source_page', + 'column_marker': 'marker', } bbox_key_map = { 'column_en': 'bbox_en', 'column_de': 'bbox_de', 'column_example': 'bbox_ex', 'page_ref': 'bbox_ref', + 'column_marker': 'bbox_marker', } # Group cells by row_index @@ -4238,12 +4240,14 @@ def _cells_to_vocab_entries( 'german': '', 'example': '', 'source_page': '', + 'marker': '', 'confidence': 0.0, 'bbox': None, 'bbox_en': None, 'bbox_de': None, 'bbox_ex': None, 'bbox_ref': None, + 'bbox_marker': None, 'ocr_engine': row_cells[0].get('ocr_engine', '') if row_cells else '', }