This commit is contained in:
Poison Flower
2026-09-18 01:00:58 +03:00
parent 02da1023ee
commit 41c994277b
10 changed files with 843 additions and 456 deletions
+15 -6
View File
@@ -1,27 +1,36 @@
"""
OCR module: batch-transcribes (or translates) scanned pages into per-page
.txt files. Light novel and manga pages are handled by separate scripts,
since their layouts need genuinely different logic (dense running prose
vs. scattered, typed speech bubbles that benefit from translation +
glossary + cross-page continuity context).
since their LAYOUT needs genuinely different logic (dense running prose
vs. scattered, typed speech bubbles) — but both support --translate with
a glossary and cross-page continuity context, sharing that (and all the
config/state/logging plumbing) via common.py rather than duplicating it.
Novel (light novel, dense running prose):
- novel_ocr.py Any OpenAI-compatible API (OpenRouter, a direct
provider endpoint, a self-hosted proxy, etc.)
with a multimodal model. Recommended.
with a multimodal model. Transcribe or
--translate. Recommended.
- google_vision_ocr.py Classic OCR via Google Cloud Vision (no LLM,
--mode novel).
Manga (speech bubbles / narration boxes / SFX):
- manga_ocr_llm.py Any OpenAI-compatible API. Transcribe or
--translate, with --glossary and --context-pages
for cross-page continuity. Recommended.
--translate, with --glossary, --context-pages,
and --context-pages-ahead for cross-page
continuity. Recommended.
- google_vision_ocr.py Classic OCR via Google Cloud Vision (no LLM,
--mode manga; transcription only, no translation).
- local_mangaocr_ocr.py Fully offline, no cloud account, via manga-ocr
(also supports --mode novel via column
segmentation, transcription only).
common.py: shared infrastructure used by novel_ocr.py and manga_ocr_llm.py
— config/state/logging plumbing, the OpenAI-compatible request helper
(with a system/user prompt split for provider-side caching), and the
--translate helpers (glossary, sliding-window context). Not meant to
be run directly.
Each script is self-contained and runnable directly, e.g.:
python -m ocr.novel_ocr --input ./pages --output ./out
python -m ocr.manga_ocr_llm --input ./pages --output ./out --translate