Feat: v0.12 Pipeline Separation, Spacing Fix, and Idempotent Restoration
This commit is contained in:
+26
-8
@@ -34,16 +34,25 @@ python pipeline/02_translate.py --input-epub inputs/my_book.epub
|
||||
```
|
||||
Translates entries in `manifest.json`. ensuring `.env` has `OPENAI_API_KEY`.
|
||||
|
||||
### Step 3: Assembly
|
||||
### Step 3: Assembly
|
||||
### Step 3: Restore Format (NEW)
|
||||
```bash
|
||||
# Bilingual Output (Default: output/bilingual_my_book.epub)
|
||||
python pipeline/03_assemble.py inputs/my_book.epub --bilingual
|
||||
|
||||
# Target Language Output (Default: output/translated_my_book.epub)
|
||||
python pipeline/03_assemble.py inputs/my_book.epub
|
||||
python pipeline/03_restore_format.py inputs/my_book.epub
|
||||
```
|
||||
**Note**: The Assembly step now includes an **LLM-based Placeholder Repair** mechanism. If `format_restorer` detects broken placeholders in the translation, it will query the LLM (using your configured credentials) to attempt an automatic fix. Ensure your `OPENAI_API_KEY` is set if you want this feature enabled.
|
||||
**Optimizes and validates translations**:
|
||||
1. Applies "Pangu" spacing (inserts space between Chinese and English/Numbers).
|
||||
2. Restores HTML tags using placeholders.
|
||||
3. Attempts **LLM Auto-Repair** if validation fails.
|
||||
4. Saves result to `manifest.json` (`translated_html` field).
|
||||
|
||||
### Step 4: Build EPUB
|
||||
```bash
|
||||
# Bilingual Output (Default)
|
||||
python pipeline/04_build_epub.py inputs/my_book.epub --bilingual
|
||||
|
||||
# Target Language Output
|
||||
python pipeline/04_build_epub.py inputs/my_book.epub
|
||||
```
|
||||
**Pure assembly**: Injects the pre-validated `translated_html` into the EPUB structure. Fast and deterministic.
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -88,6 +97,15 @@ If you see `AuthenticationError` despite having the correct `base_url` in config
|
||||
|
||||
## Change Log
|
||||
|
||||
### [2026-02-01] Pipeline Separation & Formatting
|
||||
* **Architecture**: Decoupled "Restoration" from "Assembly" into a 4-step pipeline.
|
||||
* **New Step 3**: `03_restore_format.py` handles formatting, spacing, and repair. Saves to `translated_html`.
|
||||
* **New Step 4**: `04_build_epub.py` handles pure EPUB generation.
|
||||
* **Data Model**: Added `translated_html` to `ManifestEntry` as the "Gold Master" formatted content.
|
||||
* **UX**: Added **Pangu Spacing** (Auto-spacing between CJK and ASCII) in Restoration step.
|
||||
* **Optimization**: `RestorationEngine` is now idempotent (skips processing if `translated_html` exists). Added `--force-restore` flag.
|
||||
* **Fix**: `main.py` updated to orchestrate the new 4-stage pipeline.
|
||||
|
||||
### [2026-01-31] Robustness & Repair
|
||||
* **Feature**: Added **LLM-based Placeholder Repair** in Assembly stage. If placeholders mismatch, the system asks the LLM to fix the tags without changing text.
|
||||
* **Fix**: Solved `FormatExtractor` "phantom placeholders" issue by correctly unescaping HTML entities during integrity checks.
|
||||
|
||||
Reference in New Issue
Block a user