38 lines
2.0 KiB
Python
38 lines
2.0 KiB
Python
"""
|
|
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 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. 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, --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
|
|
"""
|