Synchronize chapter and navigation translations with Chinese prose indentation

This commit is contained in:
Kai Tan
2026-10-08 07:59:01 +08:00
parent caf9d8f4bb
commit a158b4e26c
18 changed files with 613 additions and 11 deletions
+5 -1
View File
@@ -12,6 +12,7 @@ from src.common.config import load_global_config
from src.preprocessing.epub_cleaner import EpubCleaner
from src.preprocessing.profiler import BookProfiler
from src.preprocessing.text_extractor import FineGrainedExtractor
from src.preprocessing.navigation import prepare_navigation
from src.translation.manifest_manager import ManifestManager
from src.translation.translator_engine import Translator
from src.translation.glossary import prepare_glossary
@@ -65,7 +66,8 @@ async def run_pipeline(args):
if work["structure"].exists() and not args.force_clean:
logger.info(f"Reusing existing book_structure: {work['structure']}")
structure = BookStructure.load(work["structure"])
if structure.source_sha256 != hashlib.sha256(input_path.read_bytes()).hexdigest():
if (structure.preprocessing_version < 3 or
structure.source_sha256 != hashlib.sha256(input_path.read_bytes()).hexdigest()):
logger.info("Source changed or old preprocessing cache; re-cleaning")
structure = BookStructure.load(EpubCleaner(input_path, work["root"]).clean())
else:
@@ -77,6 +79,8 @@ async def run_pipeline(args):
# 2. Extraction
extractor = FineGrainedExtractor()
manifest_entries = extractor.extract(structure)
prepare_navigation(input_path,structure,manifest_entries)
structure.save(work["structure"])
# 3. Manifest Management
manifest_manager = ManifestManager(work["manifest"])