
| Typical approach | Wenyi |
|---|---|
| Segments translated in isolation, unaware of surrounding content | Whole-book prescan with chapter digests and rolling context |
| Glossary managed manually or as an afterthought | Real-time term extraction with conflict detection, fed back into subsequent batches |
| Single-pass translation, fragile to interruptions | Batch checkpoints and chapter status tracking: resume any interrupted run with the same command |
| Raw model output, no systematic quality process | Translate → polish → evidence-driven whole-book review |
Wenyi is designed for long-form texts — novels, social-science monographs, narrative nonfiction, and more.
A bilingual reading sample: translation alongside visually subdued source text.
Wenyi requires Python 3.10+ and uv.
git clone https://github.com/BigDawnGhost/wenyi.git
cd wenyi
uv syncSet your API key:
export DEEPSEEK_API_KEY=sk-...uv run trans-novel translate book.epubThis parses the book, detects the source language, prescans for understanding, translates all chapters, and assembles the output. The monolingual Chinese EPUB is written to output/book.zh.epub by default.
Multilingual translation (experimental): select a direction using language.source / language.target, such as zh → en or en → ja. Run uv run trans-novel languages for the list. Targets have separate state and output names. See the usage guide.
# 1. Prepare — parse, analyze, prescan (no body text translated)
uv run trans-novel prepare book.epub
# 2. Translate — resume from the prepared state
uv run trans-novel translate book.epub
# 3. Review — independent final review against the completed glossary
uv run trans-novel review book.epub
# 4. Check progress
uv run trans-novel status book.epubEvery completed batch is persisted immediately. If a run is interrupted, execute the same command again:
uv run trans-novel translate book.epubuv run trans-novel translate book.epub --polish --review # enable polishing and final review
uv run trans-novel translate book.epub --no-polish # disable polishing
uv run trans-novel translate book.epub --no-review # skip final review
uv run trans-novel translate book.epub --bilingual # produce both editions
uv run trans-novel translate book.epub --chapter 0 # translate the first chapter (indices start at 0)
uv run trans-novel translate book.epub --format txt # export as plain textFinal review runs by default after the complete book has been translated and the
glossary has reached its final state. Pass --no-review or set
pipeline.review: false to skip it. You can also run Agent Review independently:
uv run trans-novel review book.epub
uv run trans-novel review book.epub --autofixEach Review run starts from the beginning, checks chunks concurrently, and can
selectively request cross-book evidence before resolving contradictory
consistency suggestions. Confirmed issues can produce provisional full-segment
replacements in a run-local shadow translation. A fresh whole-book review sees
the shadow text—but not the previous issue explanation—and validates it again.
Review publishes to formal chapter target values by default. Pass
--no-autofix or set pipeline.review_autofix: false to keep the run
read-only. With Autofix, folded changes are applied first and remaining
issues reuse the existing Review Agent Loop and Fixer against that updated text.
Only formal segment target values are replaced; full history stays in the Review
directory's autofix/index.json. The consolidated result, run usage, events, and
internal records are written under state/<book>/targets/<target-language>/reviews/review-<timestamp>/.
| Input | Output |
|---|---|
| EPUB, FB2, TXT, Markdown, HTML, PDF, DOCX | EPUB (monolingual / bilingual), TXT, HTML, Markdown, DOCX |
| SRT (movie / series subtitles) | .zh.srt (monolingual) and optional .zh-bi.srt (bilingual) |
MINERU_API_KEY for the initial conversion; the resulting HTML is cached and reused. The BabelDOC bridge is optional for layout-preserving PDFs.config.yaml..srt input is auto-detected by translate. It uses a light concurrent path (no glossary, polish, or whole-book review). State lives under state/srt/<slug>/targets/<target-language>/; outputs default to the source file's output/ directory. Details: Usage guide..docx input uses the full book pipeline. Headings, simple tables, lists, and common run/paragraph styles are preserved where possible; translated Chinese uses Song (宋体). Default export is .zh.docx (override with --format). Details: Usage guide.…When enabled, the prescan runs in parallel with configurable concurrency and is idempotent — completed digests are reused across runs. During translation, each batch receives the most recent glossary snapshot and translated context, keeping pronouns, terms, and tone consistent across chapters. The Review Fixer receives the same style brief, book synopsis, chapter digest, relevant glossary subset, and nearby source/translation context used to preserve the book's voice. Its normal Review-loop replacements remain temporary; the optional Autofix publisher can later reuse it to produce formal segment targets.
Translated state directories for public-domain books may be shared through wenyi-bookcase. Do not publish copyrighted text, private books, or state/ directories containing sensitive information without permission.
If this project has been helpful, tips are welcome.
Wenyi is also hosted on AtomGit: https://atomgit.com/BigDawnGhost/wenyi
No open issues yet, or sync has not completed.