ebook-GPT-translator  by jesselau76

CLI tool for ebook translation using OpenAI

created 2 years ago
1,679 stars

Top 25.8% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

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

  • Install dependencies: pip install -r requirements.txt
  • Configure API key and settings in settings.cfg (rename from settings.cfg.example).
  • Run translation: python text_translation.py <filename>
  • Requires Python 3, OpenAI API key, and libraries like pdfminer, openai, tqdm, ebooklib, bs4.

Highlighted Details

  • Supports PDF, DOCX, EPUB, MOBI input formats.
  • Outputs EPUB and TXT files.
  • Offers bilingual output option.
  • Includes a --test flag for limited translation to save API costs.
  • Supports custom translation styles (e.g., "红楼梦风格的半文言文") and a translation table for improved accuracy.

Maintenance & Community

Licensing & Compatibility

  • Released under the MIT License.
  • Intended for public domain books; users must ensure they have rights for copyrighted content.

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.

Health Check
Last commit

1 year ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
9 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.