gitwtfhub

wtf is bilingual-book-builder?

kerivin/bilingual-book-builder — explained in plain English

Analysis updated 2026-05-18

11PythonAudience · generalComplexity · 3/5Setup · moderate

TL;DR

A command line tool that merges two ePub translations of the same book into one bilingual ePub with matching sentences shown side by side.

Mindmap

mindmap
  root((repo))
    What it does
      Merges two ePubs
      Aligns sentences
      Side by side layout
    Tech stack
      Python
      bertalign
      LaBSE
    Use cases
      Bilingual reading
      Language learning
      Chapter alignment tuning
    Audience
      Language learners
      Readers

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

Why would anyone build with this?

REASON 1

Turn an original book and its translation into a single ePub for side by side bilingual reading.

REASON 2

Practice a new language by reading original sentences next to their translation in one file.

REASON 3

Fine-tune chapter matching and sentence alignment for books in less common language pairs.

What's in the stack?

PythonbertalignLaBSEWtpsplit

How it stacks up

kerivin/bilingual-book-builder2arons/llm-cliadzza/guardium-dns
Stars111111
LanguagePythonPythonPython
Setup difficultymoderateeasymoderate
Complexity3/52/53/5
Audiencegeneraldevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 30min

Needs pip install with a GPU or CPU variant, and works best if you specify source and target languages.

Wtf does this do

bilingual-book-builder is a command line tool that takes two ePub versions of the same book, one in the original language and one translated, and combines them into a single new ePub with matching sentences placed side by side. The goal is to help someone read a book in a foreign language while seeing the original sentence right next to its translation. The process runs in three stages, and each stage relies on its own set of language models, so overall language support depends on all three working together. First, if you do not specify the languages yourself, a detector figures out what language each book is written in. Second, the text of each book is split into individual sentences, either with a fast simple splitter that covers two dozen languages or a more capable model based splitter that covers many more. Third, a sentence alignment model matches corresponding sentences between the two books using a technique called bertalign. The author notes that even languages not officially listed by these tools often still work in practice. You can install it with pip, choosing a version built for a machine with a graphics card or one for CPU only, or you can try it online through a hosted demo on HuggingFace, which the README warns is fairly slow and blocked in some regions. Once installed, the basic command just points at a source ePub and a target ePub, and the tool auto detects languages, matches chapters between the two books, and produces one merged bilingual ePub. There are many optional settings for tuning speed against accuracy: you can name the source and target languages directly to skip detection, control how many threads run in parallel, adjust how strictly chapters are matched, choose which book's cover art to keep, and swap in different alignment or splitting models if the defaults do not suit your languages. Chapters can also be matched manually instead of automatically if the automatic matching gets it wrong. The author is upfront that results depend heavily on the quality of the source ePubs, since messy tables of contents or missing metadata can throw off chapter matching, and mentions the code was written with AI assistance. Known limitations include some chapters being missed entirely, loss of text styling like bold and italics, and the tool currently only supporting a side by side layout rather than a stacked one.

Yoink these prompts

Prompt 1
Show me the bbb command to merge original.epub and translation.epub with auto-detected languages.
Prompt 2
Explain the difference between --simple-split and the model based sentence splitter in bilingual-book-builder.
Prompt 3
Help me manually match chapters with the -m flag when auto-matching gets the chapter order wrong.

Frequently asked questions

wtf is bilingual-book-builder?

A command line tool that merges two ePub translations of the same book into one bilingual ePub with matching sentences shown side by side.

What language is bilingual-book-builder written in?

Mainly Python. The stack also includes Python, bertalign, LaBSE.

How hard is bilingual-book-builder to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is bilingual-book-builder for?

Mainly general.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.