Normalize Chinese Part ordinals and support resumable complete-book translation
This commit is contained in:
@@ -47,7 +47,9 @@ async def run_pipeline(args):
|
||||
ensure_directory(output_dir)
|
||||
|
||||
# Load Config
|
||||
config = load_global_config()
|
||||
if getattr(args, 'env_file', None):
|
||||
load_dotenv(args.env_file, override=True)
|
||||
config = load_global_config(getattr(args, 'config', 'config/config.yaml'))
|
||||
llm_conf = config.get("llm", {})
|
||||
trans_conf = config.get("translation", {})
|
||||
|
||||
@@ -77,7 +79,7 @@ async def run_pipeline(args):
|
||||
structure = BookStructure.load(book_structure_json)
|
||||
|
||||
# 2. Extraction
|
||||
extractor = FineGrainedExtractor()
|
||||
extractor = FineGrainedExtractor(complete_book=getattr(args, 'complete_book', False))
|
||||
manifest_entries = extractor.extract(structure)
|
||||
prepare_navigation(input_path,structure,manifest_entries)
|
||||
structure.save(work["structure"])
|
||||
@@ -112,6 +114,8 @@ async def run_pipeline(args):
|
||||
# Profiling
|
||||
profiler = BookProfiler(llm_client, cache_path=work["root"] / "profile.json")
|
||||
profile = await profiler.analyze(manifest_manager.entries)
|
||||
if getattr(args, 'complete_book', False):
|
||||
profile.style_guide += '\nTranslate every supplied unit fully, including front matter, copyright, notes and bibliography. Never omit text based on editorial preferences.'
|
||||
logger.info(f"Book Profile: {profile}")
|
||||
|
||||
# Translation
|
||||
@@ -196,6 +200,9 @@ def main():
|
||||
parser.add_argument("--output-dir", default="output", help="Directory for output files")
|
||||
parser.add_argument("--visual-qa", action="store_true", help="Render Calibre QA page images for visual inspection")
|
||||
parser.add_argument("--glossary", help="Per-book JSON terminology file")
|
||||
parser.add_argument("--config", default="config/config.yaml", help="Local YAML configuration file")
|
||||
parser.add_argument("--env-file", help="Local credential dotenv file (never committed)")
|
||||
parser.add_argument("--complete-book", action="store_true", help="Include notes, bibliography, index, copyright and non-spine text documents")
|
||||
parser.add_argument("--model", default=None, help="LLM Model to use (overrides config)")
|
||||
parser.add_argument("--bilingual", action="store_true", help="Output bilingual version (default is target language only)")
|
||||
parser.add_argument("--skip-translation", action="store_true", help="Skip LLM translation (for testing)")
|
||||
@@ -211,4 +218,3 @@ def main():
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user