funstory-ai/BabelDOC
Yet Another Document Translator
BabelDOC – PDF scientific‑paper translation with bilingual output
What it is – BabelDOC is a Python library / CLI that translates PDF documents (especially scientific papers) from a source language into a target language and produces a bilingual PDF (original + translation side‑by‑side or alternating pages). It drives the translation with an LLM‑based service (OpenAI‑compatible models such as gpt‑4o‑mini, glm‑4‑flash, deepseek‑chat, etc.) and includes a rich set of PDF‑pre‑processing options to keep layout, formulas, tables and fonts intact.
Key capabilities
- Command‑line interface (
babeldoc) and a Python API for programmatic use. - Supports English → Chinese as the primary pair; basic English‑to‑English support is also available.
- Bilingual PDF generation – original and translated pages can be placed side‑by‑side, alternated, or output as separate monolingual files.
- Fine‑grained PDF handling: page selection, line‑splitting, OCR work‑arounds, formula detection, table translation, font overrides, watermark control, and compatibility tweaks for problematic PDFs.
- Glossary injection – CSV glossaries can be loaded so that domain‑specific terms are forced in the LLM prompt.
- Offline assets – a single zip can bundle required fonts and models for air‑gapped deployments.
- Rate‑limit and parallelism – QPS throttling and configurable worker pools.
- Self‑deployment – can be run locally (via
uvor a virtual environment) or through the hosted beta service Immersive Translate – BabelDOC (free quota of 1 000 pages/month).
Typical workflow
# install the tool (requires uv and Python 3.12)
uv tool install --python 3.12 BabelDOC
# translate one or more PDFs using an OpenAI‑compatible model
babeldoc \
--openai \
--openai-model "gpt-4o-mini" \
--openai-base-url "https://api.openai.com/v1" \
--openai-api-key "YOUR_KEY" \
--files paper.pdf
Options let you change source/target languages (--lang-in, --lang-out), select pages (--pages), enable OCR work‑arounds, control watermarking, supply glossaries (--glossary-files), and more.
Installation
- Recommended: use uv (
uv tool install --python 3.12 BabelDOC). - Alternatively, clone the repo and run
uv run babeldoc …. - The package is published on PyPI (
pip install BabelDOCworks but the README suggests uv for best experience).
Where it fits
- AI‑driven translation: the heavy lifting is done by LLMs, not traditional MT engines.
- Document‑processing pipeline: combines layout analysis, optional OCR, and LLM prompting in a single end‑to‑end tool.
- Embeddable: can be called from other Python programs or integrated into reference‑manager plugins (e.g., Zotero via
immersive-translate/zotero-immersivetranslateorguaguastandup/zotero-pdf2zh).
Status & community
- Beta online service available; free tier provides 1 000 pages/month.
- Open‑source, MIT‑style license (see
LICENSE). - Contributions are welcome; a hiring page is linked in the README.
Useful links
- Online demo: https://app.immersivetranslate.com/babel-doc/
- Self‑hosted backend: https://github.com/PDFMathTranslate-next/PDFMathTranslate-next
- Documentation: https://funstory-ai.github.io/BabelDOC/supported_languages/
- Telegram community: badge in the header.
All information above is taken directly from the repository’s README; no additional features have been inferred.
Related
- Project
- Project
- Project
- Project
- Project