- Python 84.9%
- HTML 13.7%
- Shell 1.4%
Add CDP, cookies, and one-command mise usage instructions. Update supported sites and architecture sections. |
||
|---|---|---|
| output | ||
| parsers | ||
| scripts | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| .python-version | ||
| AGENTS.md | ||
| comparison-tool-plan.md | ||
| extract_comparison.py | ||
| frontend-comparison-spec.md | ||
| migrate_sections.py | ||
| mise.toml | ||
| normalize_translations.py | ||
| pyproject.toml | ||
| README.md | ||
| scrape_to_epub.py | ||
| sugoi-translator.html | ||
| translate_novel.py | ||
| uv.lock | ||
Syosetu → Astro Translator
Scrapes chapters from a syosetu.com novel, translates via LM Studio, and writes Astro-compatible markdown files.
Setup
uv sync
Point LM_STUDIO_URL in translate_novel.py to your LM Studio server address.
Usage
Translate with model selection
uv run python translate_novel.py
Without arguments, the script prompts you to select model(s) interactively.
Specify model(s) by CLI argument (config key or model ID):
uv run python translate_novel.py unsloth/qwen3.5-9b@q8_0
uv run python translate_novel.py google/gemma-4-26b-a4b unsloth/qwen3.5-9b@q8_0
Flags
| Flag | Description |
|---|---|
--section N |
Translate only section N (1–14) |
--chapter N |
Translate only chapter N. If --section is also set, N is the chapter-within-section number; otherwise N is the absolute chapter number |
--force |
Re-translate existing chapters (skips mtime check) |
Examples:
# Section 14 only
uv run python translate_novel.py unsloth/qwen3.5-9b@q8_0 --section 14
# Single chapter, force retranslate
uv run python translate_novel.py unsloth/qwen3.5-9b@q8_0 --section 14 --chapter 4 --force
Post-processing
# Normalize spacing for cross-model comparison
python normalize_translations.py [--dry-run] [--verbose] [--normalize-quotes]
# Extract paragraph-aligned comparison data
python extract_comparison.py [--align {direct,merged,both}]
Migration
python migrate_sections.py
Output structure
output/n5290ea/
├── raw/ # Scraped Japanese source
├── translated/{model}/ # Translation output by model
└── normalized/{model}/ # Spacing-normalized copies for comparison
Model configuration
Models are configured in MODEL_CONFIGS in translate_novel.py. Each entry defines temperature, sampling parameters, chunk size, and the system/user prompts sent to the LM Studio API. Model metadata (GPU layers, context window) is stored in MODEL_METADATA.
Config keys are matched to LM Studio model IDs via the model_id field. If a config key contains /, it's used as-is in output folder names (e.g., unsloth/qwen3.5-9b@q8_0 → unsloth-qwen3.5-9b@q8_0).
Components
| Script | Purpose |
|---|---|
translate_novel.py |
Main pipeline: scrape + translate + write |
normalize_translations.py |
Post-process translated files for comparison |
extract_comparison.py |
Build paragraph-aligned comparison data across models |
migrate_sections.py |
Migrate files to section-based naming |