Guide · Parser evaluation

Test an OCR parser with a controlled corpus

Keep the dataset, parser and results tied together. Use the included CLI to generate a corpus, prepare neutral inputs and score predictions from the parser you run separately.

The evaluation boundary

A benchmark is a handoff and a score, not only a folder of PDFs

V2 separates document generation from parser execution. You create a dataset with canonical truth, build a neutral bundle that removes labels and identifying metadata, give that bundle to your parser, then import its JSONL predictions for local scoring. The oracle stays in a separate directory and is never part of the parser handoff.

The resulting CER/WER belongs to the named parser, corpus, task version, normalization, and product revision. It lets you compare two runs on the same oracle; it does not reproduce a vendor's published headline score or predict every production document.

Suite → parser → report

Run the six-step local loop

  1. 1 · Plan

    Choose a paired or mixture SuiteSpec with the document types, conditions, seed, and split policy that matter to your application.

  2. 2 · Preflight

    Compile the suite and inspect every source/condition cell before writing an output directory.

  3. 3 · Generate

    Publish the dataset, manifest, annotations, page images, recipe, coverage, and any requested exports together.

  4. 4 · Handoff

    Create neutral PDF cases. The parser receives case files and hashes, not source text, annotations, recipes, or the private oracle.

  5. 5 · Predict

    Write one run header and one hash-bound case record per parser response. Missing and failed cases stay in the denominator.

  6. 6 · Score

    Score the predictions locally, then compare runs only when task, oracle, matching rules, and quarantine subset agree.

CLI workflow

Preflight, generate, bundle, score, compare

Export the bundled starter suite to a new directory. It produces two authored memos in clean and image-only conditions, giving you four PDF cases:

Windows PowerShell

& '.\_internal\DocumentGenerator_v2.0_cli.exe' demo --write-examples ocr-examples

Linux AppImage

./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli demo --write-examples ocr-examples

Linux Flatpak

flatpak run com.docsetgenerator.DocSetGenerator --cli demo --write-examples ocr-examples

Preview the plan without writing files:

Windows PowerShell

& '.\_internal\DocumentGenerator_v2.0_cli.exe' generate --suite ocr-examples/first_run.json --preflight

Linux AppImage

./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli generate --suite ocr-examples/first_run.json --preflight

Linux Flatpak

flatpak run com.docsetgenerator.DocSetGenerator --cli generate --suite ocr-examples/first_run.json --preflight

Generate the four PDFs:

Windows PowerShell

& '.\_internal\DocumentGenerator_v2.0_cli.exe' generate --suite ocr-examples/first_run.json --output output/ocr-pairs --workers 2 --validate

Linux AppImage

./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli generate --suite ocr-examples/first_run.json --output output/ocr-pairs --workers 2 --validate

Linux Flatpak

flatpak run com.docsetgenerator.DocSetGenerator --cli generate --suite ocr-examples/first_run.json --output output/ocr-pairs --workers 2 --validate

Create the parser bundle and its private oracle:

Windows PowerShell

& '.\_internal\DocumentGenerator_v2.0_cli.exe' evaluate bundle --dataset output/ocr-pairs --task ocr --out handoff/ocr-pairs

Linux AppImage

./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli evaluate bundle --dataset output/ocr-pairs --task ocr --out handoff/ocr-pairs

Linux Flatpak

flatpak run com.docsetgenerator.DocSetGenerator --cli evaluate bundle --dataset output/ocr-pairs --task ocr --out handoff/ocr-pairs

Run your parser on the cases in handoff/ocr-pairs and save predictions.jsonl using the prediction format below. Then score it:

Windows PowerShell

& '.\_internal\DocumentGenerator_v2.0_cli.exe' evaluate score --oracle handoff/ocr-pairs_oracle --predictions predictions.jsonl --out reports/ocr-pairs-a

Linux AppImage

./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli evaluate score --oracle handoff/ocr-pairs_oracle --predictions predictions.jsonl --out reports/ocr-pairs-a

Linux Flatpak

flatpak run com.docsetgenerator.DocSetGenerator --cli evaluate score --oracle handoff/ocr-pairs_oracle --predictions predictions.jsonl --out reports/ocr-pairs-a

Optional: score a second parser into reports/ocr-pairs-b against the same oracle, then compare the two reports:

Windows PowerShell

& '.\_internal\DocumentGenerator_v2.0_cli.exe' evaluate compare reports/ocr-pairs-a reports/ocr-pairs-b --out reports/ocr-pairs-comparison

Linux AppImage

./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli evaluate compare reports/ocr-pairs-a reports/ocr-pairs-b --out reports/ocr-pairs-comparison

Linux Flatpak

flatpak run com.docsetgenerator.DocSetGenerator --cli evaluate compare reports/ocr-pairs-a reports/ocr-pairs-b --out reports/ocr-pairs-comparison

Use fresh destinations. The preflight command prints the resolved matrix and stops before creating output. The bundle command creates neutral case_0001.pdf-style inputs and a cases.json hash index, with the private oracle in the sibling handoff/ocr-pairs_oracle directory by default. Run your parser on the bundle before scoring its predictions.jsonl; the evaluator does not execute the parser. Comparison requires a second compatible report.

Prediction format

Return hash-bound JSONL

{"record_type":"run","schema_version":"1.0","parser":{"name":"my-parser","version":"1.0"},"task":"ocr","task_version":"1.0"}
{"case_id":"case_0001","sha256":"<hash from cases.json>","status":"ok","text":"Recognized page text"}
{"case_id":"case_0002","sha256":"<hash from cases.json>","status":"failed","error":"Timed out"}

For the fields task, return a scalar mapping such as "fields":{"invoice_number":"INV-123"}. Unknown IDs, duplicate cases, mismatched hashes, invalid values, and incompatible task headers fail import. The evaluator normalizes OCR text with NFKC and collapsed whitespace while retaining case and punctuation for the configured metrics.

Supported evaluation inputs

Know which corpus can be scored

Supported in parser evaluationNot supported by this evaluator
Invoice, letter, and memo PDFs, plus PDF types from supported authored families, including the current automatic expanded default.Native DOCX/XLSX/EML/CSV/TXT parser inputs; use their annotation or preview exports instead.
Quality 100 with clean, image-only, and current scan presets.Visible text corruption, corrupt hidden text, watermarks, Bates overlays, and reduced quality.
Fields with scalar values actually printed on the page.Table extraction, arbitrary schemas, and unsupported challenge or situation revisions.

Use the separate fields task for grounded scalar business targets. The DocVQA export is a conservative question adapter and does not make every content fact a question. See the full evaluation workflow for field maps, quarantine, and comparison rules.

Choose suitable evaluation data

Use delivery conditions to create supported scan and image-only cases for the built-in evaluator. Visible and hidden text corruption can be used with your own testing tools. See OCR training data for dataset design and review to exclude selected documents from a test.