Manga Pipeline Bug Fixes
Prompt
I have a Python manga translation pipeline (French → Persian) for 500+ pages. The pipeline does: bubble detection → OCR → translation → cleanup → typesetting → QA. 5 Critical Bugs to Fix: Translations assigned to wrong bubbles or repeated. containing_bubble() picks the smallest bubble covering 90% of text box, but fails on overlapping bubbles. Colored text detection wrong. "J-JE.." should be blue but detected as red. Bounding box points to wrong region. Text fitting unreliable. Fitter says even 11px doesn't fit, but measurement is broken. "ATTENDEZ.." and "M'DAME TATIANA.." mixed up — matcher assigns both to same bubble, leaving one empty. OCR disabled: "No module named 'pytesseract'". Requirements: Pillow + raqm for Persian RTL (no Qt/PySide6) Preserve artwork (only erase French letters, never touch art) Keep original text colors (red stays red, blue stays blue) Vazirmatn font for Persian EUH always → «ام…» never «اوه» Balloon-shaped masks (not rectangular boxes) ID-keyed translation batches to prevent mismatching Scale (500+ pages): Batch process with progress tracking and resume Persistent glossary across pages (consistent names/terms) Rolling 3-page context for translation continuity Skip and log failed pages without stopping Cache OCR/detection results Output per-page JSON + final quality_report.json Write Python functions to fix each bug. Provide code with brief comments
Answer guidance
- Real Python code for each of the 5 bugs (not just explanations) - Uses Pillow + raqm, no Qt/PySide6 - Handles 500+ pages with batch processing - ID-keyed translation to prevent mismatching - Balloon-shaped masks, not rectangles
Response not available