Repository navigation
v0.1 — open-source core
First public release of the deterministic half of the back-translation refinement workflow: the part that can be scripted, verified, and re-run by anyone.
What's inside
scripts/guard.py— the fidelity gate. 10 checks when you run it against a source + translation, 13 with a back-translation (--back): segment coverage, protected-token multiset equality (KEEP spans, display/inline math, citations, numbers), token order, math preservation, citation preservation, numeric equality, residue of mask characters, glossary consistency, length bands, duplicate detection, plus back-translation-side back-keep / back-math / back-length. Exit codes 0/1/2 = PASS/WARN/FAIL, JSON + console output.scripts/bt_common.py— segmentation (blank-line / per-line / auto), protected-element extraction and masking, CJK ratio.scripts/glossary.py— term extraction from paired ZH/EN corpora (CJK n-grams, 2-char words need count > 1 to avoid fragmentation) and glossary validation (BOM, duplicates, ambiguous mappings).scripts/bt_probe.py— free pre-flight: scale, protected-element inventory, batching advice, risk flags.scripts/report.py— turns guard JSON into a forwardable QA report (Markdown + self-contained HTML with sha256, reproduction commands, and an explicit "what this report can/cannot prove" section).scripts/license_check.py— license hook with pure-Python Ed25519 (RFC 8032 vectors verified in CI); all features pass on the free tier.references/— structured-preservation rules, fidelity rubric, report spec, 30 documented pitfalls.
Proof it works
Two demos, both replayed in CI (Ubuntu × Python 3.12/3.13, green):
- Planted-defect demo (
demo/,smoke_test.py): 7-paragraph sample with 6 classes of planted defects — the gate catches all of them, including the reverse regression (a correct translation must pass). - Real-case demo (
demo/real-case/): a desensitised 7-paragraph excerpt from an actual published-paper translation workflow (Chinese → English, arch-bridge engineering paper). Raw MT draft vs refined version: guard 10/10 PASS, zero fact-level drift (numbers 51, citations 10, equation references 1 all byte-identical), 18 edit points classified into spelling normalisation / terminology / punctuation / number form / semantic rewrite. Full-paper scope over the same 359 units: 42 changed (11.7%), 882 number tokens, 28 citation tokens, 0 drift. One honest disclosure is included: the gate flaggedFifteenwhere the source had15— the fix was not a blind digit swap but moving the number into the clause. The gate surfaces suspicion; wording stays the human's call.
cd demo && python smoke_test.py demo
cd demo/real-case && python run_real_case.pyPositioning
The semantic work (back-translation, two-round comparison, "stop after 2 rounds without improvement") lives in SKILL.md as model guidance. This repo ships the deterministic checks around it — the parts a machine can judge, so the human only judges what a machine can't.