This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is an EPUB translation project that converts English books to Chinese. The system extracts HTML files from EPUB archives, processes and translates the content using various AI translation APIs (DeepSeek, SiliconFlow, etc.), and maintains translation progress in a SQLite database.
/code/
directory that handle batch translation with progress tracking/Ops/
subdirectoriestranslate_epub_v4(单线程版本)V3.py
- Original stable single-threaded translation scripttranslate_epub_v4_optimized.py
- RECOMMENDED Optimized version with batch DB operations and translation cachingtranslate_epub.py
- Multi-threaded version with async processingmain.py
- Simple API test scriptMETA-INF/
, Ops/
(HTML content), images/
p34
for paragraphs)# RECOMMENDED: Optimized version with caching and batch operations
python code/translate_epub_v4_optimized.py
# Original stable version
python code/translate_epub_v4(单线程版本)V3.py
# Multi-threaded version
python code/translate_epub.py
# Performance comparison test
python code/performance_test.py
# Check translation progress
sqlite3 translation_progress.db "SELECT * FROM translation_progress;"
# Detailed file progress
sqlite3 translation_progress.db "SELECT file_path, ROUND(processed_lines * 100.0 / total_lines, 2) as progress_percent, status, last_updated FROM file_progress;"
# Translation group progress
sqlite3 translation_progress.db "SELECT file_path, group_index, status, updated_at FROM group_progress ORDER BY file_path, group_index;"
# Check translation cache effectiveness (optimized version)
sqlite3 translation_progress.db "SELECT COUNT(*) as cached_translations, AVG(access_count) as avg_reuse FROM translation_cache;"
# Install required packages
pip install -r code/requirements.txt
The system supports multiple AI translation providers configured in code/config.yaml
:
deepseek-chat
model)translation_progress
: Overall progress trackingfile_progress
: Per-file translation statusgroup_progress
: Translation group/batch statustranslation_cache
: Cached translations (optimized version only)line_progress
: Individual line translation tracking/Ops/
subdirectories*_translated/
directories/code/归档/
/code/
directory/cache/
directory (optimized version)