{"cells": [{"cell_type": "markdown", "metadata": {}, "source": "# Reproducing the Plainspoken Classics quality checks\nEvery number on [the quality page](https://scriptorium-press.pages.dev/quality.html) can be recomputed from\npublic files. This notebook does it live against the site \u2014 run it in Colab or anywhere with `requests`.\nThe method is the point: we want people to copy this pipeline and revive more classics.\n"}, {"cell_type": "code", "metadata": {}, "execution_count": null, "outputs": [], "source": "import requests, re, statistics\nBASE = \"https://scriptorium-press.pages.dev\"\ndef fetch(path):\n    r = requests.get(f\"{BASE}/{path}\"); r.raise_for_status(); return r.text\ndef words(t): return re.sub(r\"[^a-z0-9 ]\", \" \", t.lower()).split()\n"}, {"cell_type": "markdown", "metadata": {}, "source": "## 1. Archaism rate \u2014 how old does the free English feel?\nCount archaic tokens per 10,000 words in the classic public-domain translation vs ours.\nExpected (from the quality page): Macaulay's Herodotus \u2248 67.6/10k, ours \u2248 0.4/10k."}, {"cell_type": "code", "metadata": {}, "execution_count": null, "outputs": [], "source": "ARCH = re.compile(r\"\b(thee|thou|thy|thine|hath|doth|dost|unto|wherefore|thereof|therein|whither|\"\n                  r\"thither|hither|verily|spake|saith|shalt|wilt|ye|nay|forsooth|whosoever|peradventure|\"\n                  r\"howbeit|betwixt|nigh)\b\", re.I)\nfor label, path in [(\"Macaulay 1890\", \"sources/herodotus-old-translation.txt\"),\n                    (\"Plainspoken 2026\", \"books/herodotus.txt\")]:\n    t = fetch(path); n = len(t.split())\n    print(f\"{label}: {len(ARCH.findall(t))/n*10000:.1f} archaisms per 10k words ({n:,} words)\")"}, {"cell_type": "markdown", "metadata": {}, "source": "## 2. Independence \u2014 is the new translation genuinely new?\nScan for runs of 8+ consecutive identical words shared with the public-domain translation of the same text.\nCalibration matters: two independent *human* translations of Herodotus Book 1 share 18 such runs \u2014\npure convergence, not copying. Ours ships below that baseline."}, {"cell_type": "code", "metadata": {}, "execution_count": null, "outputs": [], "source": "def shared_runs(a, b, n=8):\n    wa, wb = words(a), words(b)\n    grams = set(tuple(wb[i:i+n]) for i in range(len(wb)-n+1))\n    runs, i = 0, 0\n    while i < len(wa)-n+1:\n        if tuple(wa[i:i+n]) in grams:\n            j = i+n\n            while j < len(wa) and tuple(wa[j-n+1:j+1]) in grams: j += 1\n            runs += 1; i = j\n        else: i += 1\n    return runs\nours = fetch(\"books/hesiod.txt\"); pd_old = fetch(\"sources/hesiod-old-translation.txt\")\nprint(\"Hesiod, ours vs Evelyn-White (1914):\", shared_runs(ours, pd_old), \"shared 8-word runs (site claim: 0)\")"}, {"cell_type": "markdown", "metadata": {}, "source": "## 3. Completeness \u2014 the paragraph-level ratio gate\nSilent omission is the deadliest translation defect. Greek\u2192English expands ~1.3\u20131.5\u00d7; any aligned section far\nbelow that is a red flag. This exact gate found (and led us to repair) 11 truncated paragraphs in one book's\nfirst edition \u2014 documented on the quality page."}, {"cell_type": "code", "metadata": {}, "execution_count": null, "outputs": [], "source": "import json as _json\nman = _json.loads(fetch(\"browse.json\"))\nfor slug in [\"herodotus\", \"hesiod\"]:\n    total = sum(w[\"w\"] for w in man[slug])\n    print(f\"{slug}: {len(man[slug])} works, {total:,} English words \u2014 per-work word counts in browse.json\")\nprint(\"Full per-section source/English alignment data: the sources/*.txt and books/*.txt pairs above.\")"}, {"cell_type": "markdown", "metadata": {}, "source": "## 4. Do it yourself\nThe pipeline: batch the source text (~1,500 words, section-aligned) \u2192 a fleet of Claude Sonnet agents translates\nunder one shared charter \u2192 mechanical gates check aligned counts and ratios \u2192 Claude Opus referees samples\nagainst the source \u2192 Claude Fable 5 arbitrates findings, rewrites flagged text, and handles what the fleet\ncan't. Orchestrated with Claude Code (Anthropic's agent harness) \u2014 subagents and workflows are built in.\nMethod details: https://scriptorium-press.pages.dev/colophon.html \u2014 take it, improve it, translate something."}], "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}}, "nbformat": 4, "nbformat_minor": 5}