# Fraktur OCR teaching experiment

These are original, synthetic German teaching passages, not quotations from a historical work, real scans, customer documents, or BookTranslator output. Experiment: September 11, 2026. Public packaging and byte-for-byte OCR replay: September 12, 2026.

## What was held fixed

Two short passages × two fonts × two models = eight original OCR calls. No calls were excluded, no OCR settings were tuned after seeing results, and no original call needed retrying. Packaging replay is a second run of the same eight inputs, not additional evidence from another corpus.

- Tesseract 5.5.3; Leptonica 1.87.0; OEM 1, PSM 6, 300 dpi.
- Images: 2200 × 460 pixels, black on white, three lines, 64-pixel font, rendered using Apple CoreText with ligatures enabled. Swift 6.3.2 on arm64 macOS was used. `*.render.json` records line/glyph counts and shaping probes. The original four PNGs were visually checked for missing glyphs and clipping.
- Two pinned `tessdata_best` models, `script/Fraktur` saved as `Fraktur.traineddata`, and `eng` as an English-configuration contrast. This is **not** a comparison with a modern German model or a tool ranking.
- Targets were fixed before recognition: exact source characters, or only U+017F replaced with U+0073. Score after NFC normalization and whitespace collapse; retain case and punctuation. The raw OCR output is not folded before either score. Distances are Levenshtein insertions, deletions and substitutions, not word errors or an accuracy percentage.
- The second target is **not** full OCR-D Level 1 transcription and does not modernize spelling. `rothe` and `Thal` were deliberately authored source forms.

`experiment.json` records the texts and policy. `results.json` contains every original result, reference length, image/model/raw hash, exit code and relative command. Raw stdout/stderr, ground-truth text, images and rendering checks are in `samples/`. No local username, customer file, account identifier or credential is needed.

## Inspect or verify

Download `experiment.json`, `results.json`, `verify-results.py`, both `fonts` files and licenses, and the `samples` directory, retaining the directory structure. Python 3's standard library is sufficient to verify stored evidence:

```sh
python3 verify-results.py
```

To rerun recognition, install Tesseract separately if needed and obtain the two exact models from the pinned public URLs in `provenance.json`. Keep them in a local `models` directory. This package does not include the large models and the script does not download or install anything:

```sh
python3 verify-results.py --models ./models
```

The optional replay makes eight calls and checks model hashes, OCR exit codes, and exact output bytes against the saved run. It writes no files. Another engine/platform version may differ; do not erase the original results to make the check pass.

On macOS, `render-fraktur.swift` can render one source using CoreText. Choose new output filenames; it writes its two output files:

```sh
swift render-fraktur.swift fonts/UnifrakturMaguntia.ttf samples/long-s.source.txt new-long-s.png new-long-s.render.json
```

Use `fonts/NotoSans-Regular.ttf` for the modern-font control and `samples/historical-spelling.source.txt` for the other passage. Different CoreText versions may render different pixels; original PNGs and their hashes are the authoritative inputs for the recorded experiment.

## Source and license provenance

- Fraktur font: unmodified UnifrakturMaguntia from [google/fonts at 8e44913e4ff26fc997e6856c1ec40ff4791c98c5](https://github.com/google/fonts/blob/8e44913e4ff26fc997e6856c1ec40ff4791c98c5/ofl/unifrakturmaguntia/UnifrakturMaguntia-Book.ttf). Keep `fonts/UnifrakturMaguntia-OFL.txt` with the font.
- Control font: unmodified Noto Sans Regular from [notofonts/noto-fonts at ffebf8c1ee449e544955a7e813c54f9b73848eac](https://github.com/notofonts/noto-fonts/blob/ffebf8c1ee449e544955a7e813c54f9b73848eac/hinted/ttf/NotoSans/NotoSans-Regular.ttf). Keep `fonts/NotoSans-OFL.txt` with the font.
- Models: [tesseract-ocr/tessdata_best at e12c65a915945e4c28e237a9b52bc4a8f39a0cec](https://github.com/tesseract-ocr/tessdata_best/tree/e12c65a915945e4c28e237a9b52bc4a8f39a0cec), Apache 2.0; the license is reproduced in `model-LICENSE.txt`. Model SHA-256 values and ordinary public download URLs are in `provenance.json` and each test result.
- Original teaching text and fixture/reproduction scripts: BookTranslator Team, 2026, released under the MIT License in `LICENSE.txt`. Font and model licenses remain separate.

## Limits

Only two short, clean, large-font texts were rendered. There is no page damage, gutter, small type, multicolumn layout, handwriting, real historical edition, independent human transcription assessment or full-book test. Neither model was adapted to these samples. No commercial OCR service, translation engine, Acrobat, or BookTranslator upload was tested. These observations demonstrate specific recognition and transcription-policy issues, not expected real-world error rates.
