From b7c3489e336c61b0ed72325bb06328ffa9301ccb Mon Sep 17 00:00:00 2001 From: Stephen Masters Date: Fri, 9 Oct 2026 13:52:45 +0100 Subject: [PATCH] docs(site): fold installation into a three-step tutorial Installation now lives in the user guide on GitHub Pages, so the site's Install page was a second copy waiting to drift. It is removed, /install/ is an alias of the tutorial, and the Install menu entry is gone. The tutorial is cut down to what shows a potential user how little there is to it: the install command, two corpus images that span the range (the Inside Facts cover, which auto-tuned Tesseract reads almost completely, and the Kar-Mi Troupe poster, which no local engine reads cleanly), and a small batch that lands the second in triage with a manifest for a person to act on. Everything further goes to the guide. The lightbox captions no longer carry transcribed benchmark scores. The home page's cards and its "Get it" paragraph point at the tutorial and the guide instead of the removed page, and the copy-button browser test runs against the tutorial. Co-authored-by: Yvette Mankerian Co-Authored-By: Claude Fable 5.1 --- site/config/_default/menus/menu.en.toml | 11 +- site/content/_index.md | 17 +- site/content/install.md | 146 ----------------- site/content/tutorial.md | 206 +++++++++--------------- site/layouts/partials/header.html | 2 +- site/tests/site.spec.ts | 2 +- 6 files changed, 95 insertions(+), 289 deletions(-) delete mode 100644 site/content/install.md diff --git a/site/config/_default/menus/menu.en.toml b/site/config/_default/menus/menu.en.toml index f470929..5f278ca 100644 --- a/site/config/_default/menus/menu.en.toml +++ b/site/config/_default/menus/menu.en.toml @@ -1,5 +1,7 @@ -# Top navigation: the product page, the two "using it" pages, the consolidated -# research section, the reference, and the page saying who is behind the tool. +# Top navigation: the product page, the tutorial, the consolidated research +# section, the reference, and the page saying who is behind the tool. There was +# an Install entry until October 2026; installation now lives in the user guide +# on GitHub Pages, and /install/ is an alias of the tutorial, which opens with it. # Restructured August 2026 -- the previous eight-entry nav spread the research # story across four tabs (Engines, Results, Method, Why) while leaving the # corpus, the tool comparison and auto-local routing out of the nav entirely. @@ -12,11 +14,6 @@ pageRef = "/" weight = 10 -[[main]] - name = "Install" - pageRef = "/install" - weight = 20 - [[main]] name = "Tutorial" pageRef = "/tutorial" diff --git a/site/content/_index.md b/site/content/_index.md index 86df72f..e2a1087 100644 --- a/site/content/_index.md +++ b/site/content/_index.md @@ -100,22 +100,23 @@ pip install "tetrak[all]" tetrak-ocr batch --backend auto-local ``` -[Installation](install/) covers the optional extras, system dependencies and -a four-step quick start. +The [tutorial](tutorial/) is the three-minute version; the +[user guide](https://scattercode.github.io/tetrak/) covers installation, the +optional extras, the command line and the Python API in full. ## Where to go next
-- **[Get it running](install/)** +- **[Follow the tutorial](tutorial/)** - The quick start, optional backend extras, system dependencies and - environment configuration. + Install it, transcribe one image and batch a small folder, in three + steps. -- **[Follow the tutorial](tutorial/)** +- **[Read the user guide](https://scattercode.github.io/tetrak/)** - Transcribe real archive images, batch a folder, and see exactly where - OCR breaks — on the material that breaks it. + Installation and the optional extras, every command and flag, the Python + API, and tutorials that go further. - **[See the research](research/)** diff --git a/site/content/install.md b/site/content/install.md deleted file mode 100644 index c9f72c0..0000000 --- a/site/content/install.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: "Installation" -kicker: "Using it" ---- - -## Quick start - -Four steps from nothing to a transcribed batch. - -### 1. System dependencies and the package - -{{< tabs >}} -{{< tab "macOS" >}} -```bash -brew install tesseract poppler -pip install "tetrak[all]" -``` -{{< /tab >}} -{{< tab "Debian / Ubuntu" >}} -```bash -sudo apt-get install tesseract-ocr poppler-utils -pip install "tetrak[all]" -``` -{{< /tab >}} -{{< /tabs >}} - -`[all]` installs every optional backend. If you would rather start small, plain -`pip install tetrak` gives you Tesseract, image handling and PDF -rasterisation — see [the extras](#optional-backends) below for what each -addition buys. - -### 2. Check what is available - -```bash -tetrak-ocr backends -``` - -Engines report honestly: a backend whose dependency is missing says so, and -names the extra that would install it. - -### 3. Run a batch - -```bash -tetrak-ocr batch --backend auto-local -``` - -Put files in `workspace/scans/` first — the [tutorial](tutorial/) walks through -this on -real archive images. Add `--quality-gate` to get the same triage behaviour -from a single named engine. - -### 4. Audit it yourself - -```bash -tetrak-ocr evaluate --all --save -``` - -Runs the committed corpus through every installed backend and writes the -benchmark. Expect roughly 65 minutes, most of it Marker. This one needs a -checkout rather than just the package — the corpus ships with the repository. - -## The package - -```bash -pip install tetrak -``` - -That gives you Tesseract, image handling and PDF rasterisation — enough to -process a folder of scans offline. Everything else is an optional extra. - -### Optional backends - -Each heavy backend is an extra, so you install only what you intend to use: - -```bash -pip install 'tetrak[claude]' # Anthropic vision API -pip install 'tetrak[easyocr]' # EasyOCR (CRAFT + CRNN) -pip install 'tetrak[paddle]' # PaddleOCR -pip install 'tetrak[paddle-vl]' # PaddleOCR-VL (document vision-language model) -pip install 'tetrak[marker]' # Marker, layout-aware PDF/image conversion -pip install 'tetrak[qa]' # quality scoring used by auto-local -pip install 'tetrak[all]' # all of the above -``` - -They are separated because the difference is not marginal: the core install is -a few tens of megabytes, while `[all]` pulls PyTorch, PaddlePaddle and several -sets of model weights — well over a gigabyte before any model downloads at -first run. - -If you call a backend you have not installed, the error tells you the exact -command rather than raising `ModuleNotFoundError`: - -```console -$ tetrak-ocr ocr scan.jpg --backend paddle -error: The 'paddle' backend needs the 'paddleocr' and 'paddlepaddle' packages, -not installed here. -Install with: pip install 'tetrak[paddle]' -``` - -{{< note kind="warning" title="The `marker` extra is copyleft" >}} -`marker-pdf` and its Surya models are, as of writing, **GPL-3.0**, with a -commercial-use exception offered by their author. This does not affect -`tetrak-ocr` itself — the extras are optional dependencies, resolved at -install time and never vendored — but it does affect anyone redistributing -a bundle that includes them. Check the current terms upstream; licence -terms change. See [licensing](reference/licensing/). -{{< /note >}} - -## System dependencies - -Two things are not Python packages and must be installed separately — the -commands are in the quick start above. **Tesseract** is the OCR engine itself — -`pytesseract` is only a wrapper around the binary. **Poppler** provides -`pdftoppm`, which `pdf2image` shells out to when rasterising PDF pages. -Without poppler, PDF input fails with `PDFPageCountError` rather than -anything obviously poppler-shaped. - -## API credentials - -The Claude backend needs an API key. Put it in a `.env` file at the root of -your working directory: - -```bash -ANTHROPIC_API_KEY=sk-ant-... -``` - -It is read with `python-dotenv` at import time. Nothing else in the package -makes network calls, so if you are not using the Claude backend you can ignore -this entirely. - -## For development - -```bash -git clone https://github.com/scattercode/tetrak.git -cd tetrak -python -m venv .venv && source .venv/bin/activate -pip install -e '.[dev]' -pytest -m "not slow" -``` - -`-m "not slow"` skips the tests that read the evaluation corpus and invoke a -real OCR engine; it runs in well under a second. Drop the flag to run -everything, which takes a minute or two. - -The evaluation corpus and harness live in `evaluation/` and are not part of the -installed package — benchmarking is something you do from a checkout. diff --git a/site/content/tutorial.md b/site/content/tutorial.md index 47855f1..6fa88be 100644 --- a/site/content/tutorial.md +++ b/site/content/tutorial.md @@ -1,171 +1,125 @@ --- title: "Tutorial" kicker: "Using it" +aliases: ["/install/"] --- -A walk through the pipeline on real material: transcribing one image, batching -a folder, and seeing why the tool you pick changes the answer. +From nothing to a transcribed folder in a few minutes. Everything beyond +these three steps is in the [user guide](https://scattercode.github.io/tetrak/). -Assumes you have [installed](install/) the package and Tesseract. - -## 1. Transcribe one file - -The corpus ships with the repository, so there is something to point at -immediately. +## 1. Install it +{{< tabs >}} +{{< tab "macOS" >}} ```bash -tetrak-ocr ocr evaluation/ocr/corpus/images/carthay-circle-postcard-back.png +brew install tesseract poppler +pip install "tetrak[qa]" ``` - -That is the reverse of a Tichnor linen postcard — printed caption text on a -plain ground, the case Tesseract handles well. You should get readable text -back. - -Now the hard one: - +{{< /tab >}} +{{< tab "Debian / Ubuntu" >}} ```bash -tetrak-ocr ocr evaluation/ocr/corpus/images/kar-mi-troupe-poster.jpg +sudo apt-get install tesseract-ocr poppler-utils +pip install "tetrak[qa]" ``` +{{< /tab >}} +{{< /tabs >}} -A vaudeville chromolithograph from about 1914, hand-lettered display type -arched over an illustration. You will get almost nothing — Tesseract scores -0.00 character similarity here. That is not a misconfiguration; it is the limit -of shape-matching OCR, and it is worth seeing directly before reading any -benchmark table. - -Side by side, the reason is obvious. Click either to enlarge. - -
- -{{< lightbox src="corpus/carthay-circle-postcard-back" alt="Reverse of a Tichnor linen postcard: printed caption text on a plain ground, with a faded rubber stamp and handwriting" title="carthay-circle-postcard-back.png — tesseract 0.60/0.50, tesseract-auto 0.91/0.71" >}} - -{{< lightbox src="corpus/kar-mi-troupe-poster" alt="Vaudeville chromolithograph with hand-lettered display type arched over an illustration, colour on colour" title="kar-mi-troupe-poster.jpg — tesseract 0.00/0.00, paddle 0.13/0.39 (the best any local backend manages)" >}} - -
- -Regular type on a plain ground on the left; on the right, letters drawn by hand, -curved along an arc, in colour over colour. Tesseract matches letter shapes -against trained forms, and the poster has no such forms to match. - -## 2. Let Tesseract configure itself - -Same engine, per-image auto-configuration: +That is Tesseract, the one engine every install has, plus the quality scoring +that lets Tetrak choose between engines. Check what you have: ```bash -tetrak-ocr ocr evaluation/ocr/corpus/images/carthay-circle-premiere.jpg --backend tesseract -tetrak-ocr ocr evaluation/ocr/corpus/images/carthay-circle-premiere.jpg --backend tesseract-auto +tetrak-ocr backends ``` -{{< lightbox src="corpus/carthay-circle-premiere" alt="Linen postcard of a world premiere at the Carthay Circle Theatre, with the caption reversed out of a dark night sky over a textured ground" title="carthay-circle-premiere.jpg — tesseract 0.00/0.00, tesseract-auto 0.49/0.86" >}} - -On this fixture the first returns nothing (0.00/0.00) and the second works -(0.49/0.86). Look at what defeats the default: pale caption text reversed out -of a dark sky, over a textured linen ground. At default contrast the lettering -never separates from its background. `analyse_image()` inspects contrast and -layout density, then picks a page-segmentation mode and contrast factor to -match. - -Tuning the engine you have is often worth more than switching engines: across -the twelve fixtures the current bands are fitted to, auto-configuration takes -Tesseract from 0.33 to 0.46 average character similarity. - -## 3. Batch a folder +Adding engines is one extra each — `[vision]` on a Mac, `[easyocr]` anywhere, +`[all]` for the lot. The guide's +[installation page](https://scattercode.github.io/tetrak/installation.html) +says what each one buys and costs. -The pipeline's normal mode. It uses a `workspace/` directory in your current -working directory, holding one folder per stage: - -```text -workspace/ - scans/ put files here - processed/ transcripts and originals end up here - triage/ anything that failed quality scoring -``` +## 2. Transcribe two images ```bash -mkdir -p workspace/{scans,processed,triage} -cp evaluation/ocr/corpus/images/*.jpg workspace/scans/ -tetrak-ocr batch --backend tesseract-auto +tetrak-ocr ocr page.jpg --backend tesseract-auto ``` -For each file you get `workspace/processed/.md` holding the transcript, -with the original moved alongside it. `workspace/scans/` is left empty — the -pipeline is built so that "what is still in scans/" is a meaningful question. +The transcript prints to stdout. `tesseract-auto` is Tesseract inspecting +each image first and picking the contrast and page layout to suit it, which +on faded or reversed-out material is the difference between a transcript and +nothing. -### The triage queue - -With `auto-local`, files whose best transcript still falls below the quality -floor never reach `workspace/processed/`: +If you have a checkout of the repository, the corpus has two items that show +the range. First, the front page of a 1930 Los Angeles theatrical trade +weekly: a display masthead over dense multi-column newsprint on aged, +low-contrast paper. ```bash -cp evaluation/ocr/corpus/images/kar-mi-troupe-poster.jpg workspace/scans/ -tetrak-ocr batch --backend auto-local +tetrak-ocr ocr evaluation/ocr/corpus/images/inside-facts-1930-cover.jpg --backend tesseract-auto ``` -The poster lands in `workspace/triage/` with a manifest listing what each backend -produced and how it scored. That is the file to send to a vision model, or to a -person. The point is that bad transcripts do not quietly enter your archive -looking like good ones. +{{< lightbox src="corpus/inside-facts-1930-cover" alt="Front page of Inside Facts of Stage and Screen, a Los Angeles theatrical trade weekly, 31 May 1930: a display masthead over dense multi-column newsprint" title="inside-facts-1930-cover.jpg — Inside Facts of Stage and Screen, 31 May 1930" >}} -## 4. Let it choose the backend +Difficult-looking, and read well: you should get a near-complete transcript +of the page, with the columns in order. This is the kind of material where +the engine you already have, tuned, is most of the answer. + +Now the hardest item in the corpus, a vaudeville chromolithograph from about +1914: hand-lettered display type arched over an illustration, colour on +colour, with tiny caption text along the foot. ```bash -tetrak-ocr batch --backend auto-local +tetrak-ocr ocr evaluation/ocr/corpus/images/kar-mi-troupe-poster.jpg --backend tesseract-auto ``` -`auto-local` runs every viable local backend over each file and keeps the -highest-scoring transcript, judged without a reference. It routes on file type -and available hardware — see [auto-local routing](reference/routing/) for the -decision table. +{{< lightbox src="corpus/kar-mi-troupe-poster" alt="Vaudeville chromolithograph with hand-lettered display type arched over an illustration, colour on colour" title="kar-mi-troupe-poster.jpg — vaudeville chromolithograph, c. 1914" >}} -It averages 0.66/0.65 on this corpus, behind PaddleOCR-VL and Vision but ahead -of every other single backend, and it is among the slowest, because it runs -several engines per file. +You will get almost nothing back, and that is not a misconfiguration. +Tesseract matches letter shapes against trained forms, and this poster has +none to match. The deep-learning engines do better, recovering a fair share +of the words between them, and no local engine reads it cleanly. That spread, +from one page read almost perfectly to another nobody reads well, is why the +next step exists. -## 5. Measure it yourself +## 3. Batch a small folder -Nothing above asks you to trust the published numbers. +Put a few scans in `workspace/scans/` and let Tetrak pick the engine per file: ```bash -tetrak-ocr evaluate --backend tesseract-auto +mkdir -p workspace/scans +cp ~/archive/*.jpg workspace/scans/ +tetrak-ocr batch --backend auto-local ``` -That scores each corpus image against its committed ground-truth transcript and -prints character similarity and word recall per fixture. To compare everything -installed: +`auto-local` runs every engine you have installed on each file, scores the +transcripts without needing a reference, and keeps the best. When it finishes: -```bash -tetrak-ocr evaluate --all --save +```text +workspace/ + scans/ empty + processed/ each transcript as .md, with the original moved in beside it + triage/ anything nothing could read well enough, with a note of what was tried ``` -`--save` writes `evaluation/ocr/benchmark.{csv,md}` plus a dated, git-linked -snapshot under `evaluation/ocr/runs/`. Expect around 50 minutes for a full run with -every backend installed, most of it Marker. - -{{< note kind="note" >}} -`--all` runs only the backends you have installed, and `--save` overwrites -the committed benchmark with whatever it managed to run. On a partial -install, keep the output rather than committing it. -{{< /note >}} - -## What each fixture is for - -Seven items, chosen to break OCR in different ways. - -| | The item | The challenge | -|---|---|---| -| {{< lightbox src="corpus/inside-facts-1930-cover" alt="Front page, LA theatrical trade weekly, 1930" title="Inside Facts of Stage and Screen, 31 May 1930 — front page" >}} | Front page, LA theatrical trade weekly, 1930
`inside-facts-1930-cover.jpg` | Heavy display masthead over dense multi-column newsprint; aged low-contrast paper | -| {{< lightbox src="corpus/inside-facts-1930-page-six" alt="Interior page of the same issue" title="Inside Facts of Stage and Screen, 31 May 1930 — page six" >}} | Interior page of the same issue
`inside-facts-1930-page-six.jpg` | Multi-column body text broken by ruled advertisement boxes | -| {{< lightbox src="corpus/kar-mi-troupe-poster" alt="Vaudeville chromolithograph, c. 1914" title="The great Victorina Troupe — vaudeville chromolithograph, c. 1914" >}} | Vaudeville chromolithograph, c. 1914
`kar-mi-troupe-poster.jpg` | Curved and arched display type, colour on colour, tiny caption text | -| {{< lightbox src="corpus/carthay-circle-premiere" alt="Linen postcard, Carthay Circle premiere" title="World Premier, Carthay Circle Theatre — postcard front, c. 1930–45" >}} | Linen postcard, Carthay Circle premiere
`carthay-circle-premiere.jpg` | Caption reversed out of a dark sky over a textured ground | -| {{< lightbox src="corpus/carthay-circle-postcard-back" alt="Reverse of the same card" title="Carthay Circle Theatre — postcard reverse, c. 1930–45" >}} | Reverse of the same card
`carthay-circle-postcard-back.png` | Text rotated 90°, faded rubber stamp, handwriting, large empty areas | -| {{< lightbox src="corpus/graumans-chinese-theatre" alt="Linen postcard, Grauman's Chinese Theatre" title="The Chinese Theatre, Hollywood, California — postcard, c. 1930–45" >}} | Linen postcard, Grauman's Chinese Theatre
`graumans-chinese-theatre.jpg` | Colour halftone with marquee lettering at the edge of legibility | -| {{< lightbox src="corpus/king-of-kings-souvenir-1927" alt="Roadshow souvenir programme, 21 pages" title="The King of Kings — roadshow souvenir programme, 1927 (first page)" >}} | Roadshow souvenir programme, 21 pages
`king-of-kings-souvenir-1927.pdf` | Multi-page PDF, tinted grounds, script headings, drop caps | +Put both images from step two through it. The trade weekly comes out in +`processed/` with its transcript beside it. The poster may well land in +`triage/`, with a manifest listing every engine that tried and the opening of +what each produced. That is the point: a poor transcript looks exactly like a +good one from the outside, so Tetrak quarantines it rather than letting it +into your catalogue, and hands the decision to a person. Reading the +manifest, you might find one engine's attempt good enough to keep, tidy it +by hand, or send the poster to the `claude` backend, which reads +hand-lettered type that local engines cannot. -Provenance and rights for each are on [the corpus page](reference/corpus/). +Add `--pdf` to also write each scan as a searchable PDF, the file a +catalogue can index. ## Where next -- [Choosing a tool](research/in-depth/#choosing-a-tool-for-your-own-material) — which backend for which document, with the evidence -- [Results](research/in-depth/#the-results) — the full benchmark, including a retracted finding -- [Method](research/in-depth/#the-weakness-at-the-centre-of-the-method) — what the numbers do and do not establish -- [Python API](https://scattercode.github.io/tetrak/guide/python-api.html) — driving the backends from code, in the user guide +- [Quick start](https://scattercode.github.io/tetrak/quickstart.html) — the + same three steps with the output explained. +- [Batch an archive](https://scattercode.github.io/tetrak/tutorials/batch-an-archive.html) + — the full walk-through, from dry run to catalogue-ready PDFs and a worked + triage queue. +- [Choosing a backend](https://scattercode.github.io/tetrak/guide/backends.html) + — which engine for which material, and what a run costs. +- [The research](research/) — nine documents, five engines, and exactly where + each one breaks. diff --git a/site/layouts/partials/header.html b/site/layouts/partials/header.html index f14192e..5ee9c61 100644 --- a/site/layouts/partials/header.html +++ b/site/layouts/partials/header.html @@ -16,7 +16,7 @@