Skip to main content

Preface OCR pipeline

How Cologne dictionary front matter (title pages, prefaces/forewords, abbreviation lists, addenda) is turned into searchable Markdown plus English and Russian editions — and which agent path produced which deliverable.

Public catalogue of finished text: OCR'd prefaces.
Cologne scan index: csldoc dictionaries.


PipelineSkill / codeInputOutputRole
CDSL front matter/cologne-preface-ocr (Claude Code command + Codex twin)csldoc PNG scansper-dict prefaces/ (source + EN/RU + *_all.*)Production path for Cologne dicts
PD (Deccan College)PD/run_ocr.py on branch feat/ocr-v2-pipelinelocal PDF front matterGA.md, AUB.md, RG.md, SWC.md, AOB.md in PDSeparate corpus; Tesseract crop-then-OCR

Do not treat the PD branch as a rename of the CDSL skill. They share layout ideas (crop-then-OCR, column modes); they do not share the same authoring engine for Cologne scans.


Engines inside the CDSL skill

EngineName in docsAuthor of canonical pages?Mechanism
AVision band OCRYesNative-resolution crops (≤ ~1900 px/side) → vision model → faithful transcription
BTesseract crop-then-OCR (Grok/PD family)No (audit only on CDSL)Tesseract `deu

Hard rule: never auto-promote B text into <code>prefNN.md. B may disagree and still be wrong (especially title names and diacritic-heavy abbreviation keys). Evidence: PWG A vs B comparison (mean Jaccard ~0.51 vs A as gold; prose best, abbrev/title worst).


CDSL phases (/cologne-preface-ocr)

PhaseWhat happens
0Resolve dict code → local repo (PWPWK, MW/MWEMWS, WIL/YATWil-YAT, …)
1Discover scan pages from csldoc toctree (trust toctree order, not filename sort)
2Download PNGs into prefaces/scans/
3Engine A — OCR each page into <code>prefNN.md (YAML header + transcription)
3.5Engine B audit (recommended) — Tesseract pass; write prefaces/AUDIT_A_VS_B.md; re-vision only flagged bands
4Translations: .en.md if source ≠ English; always .ru.md
5Consolidated *_all.* via build_combined.py
6prefaces/README.md + root README surface + cost/run notes; refresh ocr-prefaces
7Delete temp crops / _audit_b/; commit only if asked

Phase 3.5 — what B is for

SignalAction
A long, B empty in a bandPossible A invention or B crop fail → re-vision the band
B dense, A shortPossible A skip → re-OCR missing region with A
Both disagree on a number/dateRe-vision the locus from the scan
Diacritic-only key mismatchExpected B weakness — do not “fix” A toward B
B-only “Institute of Indology…”Digitizer stamp — ignore (A correctly omits)

Reference tooling: PD/compare_pwg_a_vs_b.py. Full phase text lives in the skill runbook (Claude: ~/.claude/commands/cologne-preface-ocr.md; Codex: ~/.codex/skills/cologne-preface-ocr/).

Non-negotiable OCR rule (Phase 3)

Never Read a full downsampled page. Scans are 3000–6800 px; downsampling yields fluent but fabricated text. Split columns, cut overlapping horizontal bands, keep each crop ≤ ~1900 px on its longest side.


Deliverable layout (per dictionary)

<prepo>/prefaces/
scans/ # source PNGs
<code>prefNN.md # source-language OCR (Engine A)
<code>prefNN.en.md # English (omit if source is already English)
<code>prefNN.ru.md # Russian
<code>pref_all.*.md # consolidated editions
build_combined.py
README.md
AUDIT_A_VS_B.md # optional Phase 3.5 QA

Indexed on the site: OCR'd prefaces.


Who OCR'd what: Claude Code vs Grok

Attribution is by production pipeline, not git commit identity (commits often land under the human maintainer account after an agent run). “Produced by /cologne-preface-ocr” in root-README run notes = Claude Code vision path (skill default tier: Fable 5 / Opus 4.8 fallback).

Census of local clones 23-07-2026.

Claude Code — CDSL production (Engine A, /cologne-preface-ocr)

All rows below are canonical edition pages under each repo’s prefaces/ (source + translations as applicable). None of these production files were authored by the Grok/Tesseract path.

CodeRepo~Source pagesSource langFirst landed (approx.)
PWGPWG27de2026-06-16
PWPWK5de2026-06-17
SCHSCH5de2026-06-17
MWMWS29en2026-06-17
MWEMWS (mwepref*)11en2026-07-03
GRAGRA6de2026-06-22
CCSCCS6de2026-06-22
INMINM9en2026-06-22
IEGprefaces_ieg10en2026-06-22
SHSSHS2en2026-06-22
BOPBOP5la2026-06-22
STCSTC5fr2026-06-22
VCPVCP7sa2026-06-22
MDMD10en2026-06-23
CAECAE6en2026-06-23
BHSBHS15en2026-06-23
BORBOR36en2026-06-23
VEIVEI16en2026-06-23
MW72MW7225en2026-06-23
WILWil-YAT6en2026-06-23
YATWil-YAT3en2026-06-23
KRMKRM24sa/en2026-06-23
MCIMCI28en2026-06-23

Count: 23 CDSL codes with production OCR via Claude Code / /cologne-preface-ocr (landed in a real dict or staging git repo with prefaces/ on a branch).

Claude Code — local-only / incomplete (worktree residue)

Claude Code started more than the 23 “full” dicts. Some work never landed in a dictionary remote: it sits in local staging folders under GitHub/prefaces_<code>/ (or stub dirs inside the dict clone). Those folders are not linked to a sanskrit-lexicon preface remote; many are only visible because they live under the local GitHub/ tree and are gitignored by a parent meta-repo (/* ignore). Deleted git worktrees leave no remote history of unfinished pages — only whatever still sits on disk.

Census of local machine (23-07-2026), Claude Code Engine A residue:

CodeLocal pathSource pages on diskScansStatusOn GitHub remote?
GSTGitHub/prefaces_gst/8/8 + RU + *_all.* + README8Looks complete locally — not promoted to a GST/prefaces/ remoteNo (local-only)
PGNGitHub/prefaces_pgn/10/10 + RU + *_all.* + README10Looks complete locally — not promotedNo (local-only)
SNPGitHub/prefaces_snp/7/7 + RU + *_all.* + README7Looks complete locally — not promotedNo (local-only)
LANGitHub/prefaces_lan/2/19 (+ RU for those 2); leftover _crops/19Partial (title + early pages only)No (local-only)
PEGitHub/prefaces_pe/prefaces/0 (manifests / discover scripts only)0Stub (Phase 1–2 only)No
BURBUR/prefaces/0 (_manifest, download probes, empty scans/)0StubScripts may be in dirty/WIP history only — no edition pages
PUIPUI/prefaces/scans/0 (one tiny/placeholder PNG)1StubNo edition
SKDSKD/prefaces/scans/0 (empty scans dir)0StubNo edition

Deleted worktrees: no remaining linked worktrees for AP90/BEN/AE/… preface runs; git branch -r on sample dict clones has no preface|ocr topic branches (except unrelated MWS paper scaffold). If a worktree was removed without merge/push, unfinished OCR for that run is gone unless a copy was left in prefaces_* as above.

Rescue priority (human): commit/promote local-complete GST, PGN, SNP into proper remotes before disk loss; finish LAN from remaining scans; treat BUR/PE/PUI/SKD as restart-from-skill.

Grok — production OCR (Engine B primary)

WorkLocationNotes
Deccan College PD front matter (GA, AUB, RG, SWC, AOB)PD · branch feat/ocr-v2-pipelineTesseract 5.5 eng+san; crop-then-OCR; layout modes multi_pair / multi_seq / prose_2col. Not a Cologne csldoc dict.

Grok — tooling / QA / docs (not production CDSL pages)

WorkLocationNotes
PWG A vs B bake-offCOMPARISON_PWG_OCR_A_VS_B.md, PD/pwg_a_vs_b/, compare_pwg_a_vs_b.pySample pages only; confirms A remains gold for PWG
Phase 3.5 audit designskill runbook + this pageB as comparison layer after Claude Code drafts
Skill + public index updates/cologne-preface-ocr, ocr-prefacesInventory refresh, dual-engine wording, partial-residue census

Grok has not replaced Claude Code as author of any CDSL prefaces/<code>prefNN.md edition as of this census. Future CDSL runs may still use Grok only for Phase 3.5 audit (or a human may run Tesseract locally the same way).

Not yet OCR'd (no usable local edition)

Cold queue (no full local pages, or only empty stubs): AP90, AP, AE, BEN, BUR, SKD, ABCH, ACC, LRV, PE, PUI (+ finish LAN).
Local-complete but unpublished: GST, PGN, SNP (see table above). Default author path: Claude Code / Engine A, then optional Phase 3.5 audit; for GST/PGN/SNP prefer promote existing local trees over re-OCR.


How to run (operators)

# CDSL dictionary (Claude Code or Codex with the skill loaded)
/cologne-preface-ocr PWG
/cologne-preface-ocr AP90
/cologne-preface-ocr all # skips Done inventory rows

# PD PDFs only (Grok / local Python)
cd PD
python run_ocr.py
python run_ocr.py --only AOB.pdf --start-page 20

# Optional bake-off / audit sample (PWG-shaped; adapt for other codes)
python compare_pwg_a_vs_b.py

Requirements for Phase 3.5 / PD: Tesseract 5.x with appropriate traineddata (deu, eng, san, …), pillow, pytesseract (PD also: pymupdf, numpy, beautifulsoup4).


Last census: 23-07-2026 · Pipeline docs: Grok 4.5 (grok-4.5) with skill/run-note evidence from Claude Code /cologne-preface-ocr runs.