explaingit

yihong0618/bilingual_book_maker

9,258PythonAudience · generalComplexity · 2/5Setup · easy

TLDR

A Python command-line tool that takes an ebook or text file and produces a bilingual version with the original and a translation side by side, using AI services like GPT, Claude, or DeepL.

Mindmap

mindmap
  root((bilingual book maker))
    What it does
      Bilingual output
      Side by side text
      Multiple file formats
    Input formats
      EPUB
      TXT
      SRT subtitles
      PDF
    AI providers
      OpenAI GPT
      Claude
      DeepL
      Ollama local
    Setup
      pip install
      API key required
      PyPI package
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Convert a public-domain EPUB into a bilingual edition with original and translated paragraphs side by side

USE CASE 2

Translate an SRT subtitle file into a bilingual version for language study using DeepL or GPT

USE CASE 3

Process a text file into a bilingual learning document using a local Ollama model at zero API cost

USE CASE 4

Create a bilingual PDF study copy from a document you have the rights to translate

Tech stack

PythonpipOpenAI APIEPUB

Getting it running

Difficulty · easy Time to first run · 30min

Requires an API key from your chosen translation provider (OpenAI, Claude, DeepL, etc.) or a running Ollama instance.

No license terms are mentioned in the explanation.

In plain English

Bilingual Book Maker is a Python tool that takes an ebook or text file and produces a version where every passage appears in both the original language and a translation side by side. You give it a file, tell it which AI service to use for translation, and it outputs a new file with both languages woven together. The tool supports epub, txt, srt, and pdf formats as input. The translation can be done through a wide range of AI services. The default is OpenAI's GPT models, but the tool also supports Claude, Google Gemini, DeepL, Google Translate, Alibaba's Qwen, Groq, Ollama for self-hosted models, xAI, and several others. You can even define custom providers through a JSON configuration file if you use an OpenAI-compatible API that is not built in. For most services, you need an API key from the provider, which you either pass as a command-line argument or set as an environment variable. The output file is named after the original with a bilingual suffix added. For an epub input you get a bilingual epub back, for text or subtitle files you get bilingual text output. The tool inserts a small amount of context from surrounding paragraphs with each translation request, which can help the AI produce more coherent results across a long text. The project is specifically designed for public domain works and materials you have the right to translate. The repository includes a disclaimer making clear it is not intended for copyrighted books you do not have permission to work with. A sample copy of Animal Farm is included for testing, since that book is in the public domain. To get started, you install the dependencies with pip and then run the make_book.py script with the path to your file and the API key for your chosen translation service. The tool is also available as an installable package called bbook_maker from PyPI if you prefer not to run it directly from the source.

Copy-paste prompts

Prompt 1
Using bilingual_book_maker, show me the command to convert an EPUB file into a bilingual English-Spanish version using Claude as the translation service, including how to pass the API key.
Prompt 2
I want to use bilingual_book_maker with a local Ollama model instead of a paid API. Show me the exact command-line arguments to point it at a custom OpenAI-compatible endpoint.
Prompt 3
With yihong0618/bilingual_book_maker, how do I translate an SRT subtitle file from Japanese to English while keeping the original Japanese text alongside the translation in the output?
Prompt 4
What pip install command sets up bilingual_book_maker, and how do I set my OpenAI API key as an environment variable so I don't have to pass it on the command line every time?
Open on GitHub → Explain another repo

← yihong0618 on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.