Overview of bilingual_book_maker
mainbilingual_book_maker is an AI translation tool that leverages ChatGPT to assist users in creating multi-language versions of epub and txt files and books.repository·main·Indexed 27 days ago
https://github.com/yihong0618/bilingual_book_makerAn AI-powered translation tool that uses LLMs to create multi-language versions of books and files in epub, txt, md, srt, and pdf formats. It supports a wide range of providers including OpenAI, Claude, Gemini, Groq, xAI, DeepL, and local Ollama instances. Key features include parallel processing, custom translation prompts, the ability to resume interrupted translations, and granular control over HTML tag translation for EPUB files.
bilingual_book_maker is an AI translation tool that leverages ChatGPT to assist users in creating multi-language versions of epub and txt files and books.The program can translate plain text files such as .txt and .srt. Use the --book_name flag to specify the file path and --language to specify the target language.
python3 make_book.py --book_name test_books/the_little_prince.txt --test --language zh-hans/app/test_books inside the container. The --book_name argument must then use the container's internal path prefix /app/test_books/.You can customize the translation behavior by using the --prompt parameter. The prompt supports two placeholders that will be dynamically replaced during execution:
{text}: The source text to be translated.{language}: The target language.There are three ways to provide the prompt:
If you only need to define the user role content (without a specific system role), provide a string or a path to a .txt file.
To define both a system role and a user role, provide a JSON string or a path to a .json file containing system and user keys.
For more structured prompts, you can use .md files following the PromptDown format. This allows you to define a System Message (or Developer Message for newer models) and a Conversation table.
PromptDown Structure Example:
## System Message
You are a professional translator.
## Conversation
| Role | Content |
|-------|---------|
| User | Please translate the following text into {language}:\n\n{text} |If a translation process is manually interrupted, you can resume from the last successful position by adding the --resume flag to your command.
python3 make_book.py --book_name test_books/animal_farm.epub --model google --resumeMarkdown files (.md) can be translated directly using the --book_name flag. For optimal results with Markdown structure, use the --prompt flag to provide a Markdown-specific prompt file (e.g., prompt_md.json).
python3 make_book.py --book_name your_doc.md --model chatgptapi --openai_key ${openai_key} --prompt prompt_md.jsonYou can use the bbook_maker command directly from your terminal. Provide the path to your book and your OpenAI API key using the --book_name and --openai_key flags.
bbook_maker --book_name ${path of a book} --openai_key ${openai_key}
# Example
bbook_maker --book_name test_books/animal_farm.epub --openai_key ${openai_key}To use a provider not natively supported (like DeepSeek), use the --provider flag along with --api_key. Providers must be defined in bbm_providers.json.
python3 make_book.py --book_name test_books/animal_farm.epub --provider deepseek --api_key sk-xxx --language jabilingual_book_maker is an AI translation tool that creates multilingual versions of epub, txt, md, or srt files. It is intended for books in the public domain.
You can run the tool directly from the source or install it as a package.
Option 1: Run from source
pip install -r requirements.txt
python3 make_book.py --book_name test_books/animal_farm.epub --openai_key ${openai_key} --testOption 2: Install via pip
pip install -U bbook_maker
bbook --book_name test_books/animal_farm.epub --openai_key ${openai_key} --testpip install -r requirements.txt
python3 make_book.py --book_name test_books/animal_farm.epub --openai_key ${openai_key} --testIf a translation process is interrupted, you can manually resume it using the --resume flag.
python3 make_book.py --book_name test_books/animal_farm.epub --model google --resumeYou can translate books directly from a Rakuten Kobo e-reader by specifying the device type and its mounting point. Use --book_from kobo and --device_path to point to the directory where the e-reader is mounted.
bbook_maker --book_from kobo --device_path /tmp/koboYou can install the bbook-maker package directly from PyPI using pip. It is recommended to perform this installation within a virtual environment to avoid dependency conflicts.
pip install -U bbook_maker