CLI tool for ebook translation using OpenAI
Top 25.8% on sourcepulse
This tool converts and translates e-books (PDF, DOCX, EPUB, MOBI) using the OpenAI API, targeting users who want to read content in different languages or styles. It offers flexibility in output formats (EPUB, TXT) and supports custom translation styles.
How It Works
The tool leverages the OpenAI API (gpt-3.5-turbo) for translation, processing text in segments to maintain quality. It converts various e-book formats to EPUB or TXT, handling graphical elements by placing them at the beginning of chapters in EPUB output. PDF-specific features like start/end page selection are supported due to consistent formatting.
Quick Start & Requirements
pip install -r requirements.txt
settings.cfg
(rename from settings.cfg.example
).python text_translation.py <filename>
pdfminer
, openai
, tqdm
, ebooklib
, bs4
.Highlighted Details
--test
flag for limited translation to save API costs.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
Graphical elements are not preserved in their original positions, only placed at the beginning of chapters for EPUB. Start/end page settings are exclusively for PDF files. The tool is not designed for copyrighted content.
1 year ago
1 day