# Parser evaluation

Canonical source: [Parser evaluation](https://docsetgenerator.com/evaluation)

EVALUATION

## Measure the parser you actually run

Use the included CLI evaluator to prepare neutral inputs and score your parser's prediction files locally. Inspect the measured four-case PDFium example to see the handoff and report format.

**Command-line setup**

Guide commands use the tools included with your Windows or Linux download; no separate Python installation is needed. Each guide's command examples show the complete command for the platform you choose. [Open platform setup](https://docsetgenerator.com/getting-started#command-line).

Give to your parser

### Neutral inputs

Only neutral PDFs and `cases.json` go into the public bundle.

Keep on your machine

### Private ground truth

The private answer key (oracle) retains original artifact hashes and ground truth for local scoring.

1 / BUNDLE

### Prepare neutral inputs

Neutralization keeps delivered appearance while removing identifying PDF metadata, bookmarks, attachments, and links under a bounded policy for supported generated PDFs.

2 / PARSE

### Return JSONL

Give the parser the public folder. Each response names a case and repeats its 64-character input hash.

3 / SCORE

### Read the report

Score with the sibling oracle directory. Reports include error counts, denominators, conditions, and per-case evidence.

4 / COMPARE

### Compare compatible runs

Comparison requires the same oracle, task version, normalization, field mapping, and quarantine subset.

CLI HANDOFF

### Evaluator command reference

The packaged evaluator prepares inputs and scores prediction files locally; it does not run your parser. These commands use `output/pairs` from the [suites guide](https://docsetgenerator.com/suites#suite-commands). Create the parser bundle and its private oracle:

Windows PowerShell

```powershell
& '.\_internal\DocumentGenerator_v2.0_cli.exe' evaluate bundle --dataset output/pairs --task ocr --out handoff/ocr
```

Linux AppImage

```sh
./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli evaluate bundle --dataset output/pairs --task ocr --out handoff/ocr
```

Linux Flatpak

```sh
flatpak run com.docsetgenerator.DocSetGenerator --cli evaluate bundle --dataset output/pairs --task ocr --out handoff/ocr
```

Run your parser on the cases in `handoff/ocr` and write `predictions.jsonl` in the format below. Then score it:

Windows PowerShell

```powershell
& '.\_internal\DocumentGenerator_v2.0_cli.exe' evaluate score --oracle handoff/ocr_oracle --predictions predictions.jsonl --out reports/parser-a
```

Linux AppImage

```sh
./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli evaluate score --oracle handoff/ocr_oracle --predictions predictions.jsonl --out reports/parser-a
```

Linux Flatpak

```sh
flatpak run com.docsetgenerator.DocSetGenerator --cli evaluate score --oracle handoff/ocr_oracle --predictions predictions.jsonl --out reports/parser-a
```

Optional: score a second parser into `reports/parser-b` against the same oracle, then compare the two reports:

Windows PowerShell

```powershell
& '.\_internal\DocumentGenerator_v2.0_cli.exe' evaluate compare reports/parser-a reports/parser-b --out reports/comparison
```

Linux AppImage

```sh
./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli evaluate compare reports/parser-a reports/parser-b --out reports/comparison
```

Linux Flatpak

```sh
flatpak run com.docsetgenerator.DocSetGenerator --cli evaluate compare reports/parser-a reports/parser-b --out reports/comparison
```

For a fields task, replace `ocr` with `fields`; predictions use a scalar mapping such as `"fields":{"invoice_number":"INV-123"}`. A parser field map can be supplied with `--field-map keys.json`. Unknown IDs, duplicate records, mismatched hashes, and incompatible headers fail import.

```
{"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":"<64-character hash from cases.json>","status":"ok","text":"Recognized page text"}
{"case_id":"case_0002","sha256":"<64-character hash from cases.json>","status":"failed","error":"Timed out"}
```

**Keep the oracle private.** Do not copy annotations, source text, recipes, pristine images, or manifests into the parser bundle. Rebuild the bundle if you relocate the dataset because scoring checks the recorded local paths and hashes.

SUPPORTED TASKS

### Choose the task and supported inputs

| Task | Supported inputs | Not supported by this evaluator |
| --- | --- | --- |
| OCR | Invoice, letter, and memo PDFs, plus PDFs from supported authored families, including the current automatic expanded default, at quality 100 with clean, image-only, or current scan delivery. | Native files, table extraction, visible corruption, corrupt hidden text, watermarks, Bates overlays, and unsupported overlays. |
| Fields | Grounded scalar values actually printed on supported invoice, letter, memo, or supported authored-family PDFs. Legacy scalar fields use task version 1.0; content fields use task version 2.0 and a fixed public field schema. | Unprinted values, guessed dates/currencies/units, native formats, and failed or missing responses receiving absence credit. |
| Split | Packet PDFs with declared child ranges and document classes. | Scoring packet PDFs as ordinary OCR or field-extraction cases. |

Generation and annotation exports cover a wider catalog than evaluation. The `situations-r1` route is explicitly refused by OCR and field evaluation, even when its projection is a letter or invoice.

METRICS

### Keep the denominator visible

#### OCR

CER and WER retain substitution, insertion, deletion, error, and reference-denominator counts. NFKC whitespace normalization preserves case and punctuation. Error rates can exceed 100%; zero-reference errors are undefined rather than fake infinity.

#### Scalar fields

Exact and normalized matches are reported separately. Typed dates and money use declared formats; matching is one-to-one by field key. Missing and failed cases remain in the denominator.

ACTUAL LOCAL EXAMPLE

### Open a generated report

This four-case example uses the local PDFium text-layer baseline against two clean and two image-only memo PDFs. The baseline reads existing PDF text and has no OCR engine. It reports 100% character and word accuracy for clean cases and empty predictions for image-only cases, for 50% aggregate accuracy in this particular four-case run. It is a workflow example, not a general OCR benchmark.

[Open the evaluation report](https://docsetgenerator.com/assets/examples/evaluation-demo/report.html) [Inspect cases.json](https://docsetgenerator.com/assets/examples/evaluation-demo/cases.json) [Inspect predictions.jsonl](https://docsetgenerator.com/assets/examples/evaluation-demo/predictions.jsonl)

The report identifies parser `pdfium-text-layer-baseline 1.0+156.0.8076.0`, task `ocr`, and normalization `nfkc-whitespace-v1` so you can interpret the scores. Read the [example guide](https://docsetgenerator.com/assets/examples/evaluation-demo/README.md) or inspect the [measured results](https://docsetgenerator.com/assets/examples/evaluation-demo/results.json).
