PubIDPubID

The identifier-parsing benchmark

The pubid-testsuite corpus is published as the identifier-parsing benchmark: a versioned task dataset of attested standards-identifier cases across every supported publisher flavor, a precise evaluation protocol, and a leaderboard of submitted engines. Every system that parses standards identifiers can be measured against the same task, with the same script, on the same bytes.

Task definition

Every dataset row carries an input string and a flavor (the publisher grammar the engine must apply). The engine answers either:

Rows are exactly two kinds:

kind rows are expected payload
parse each corpus case’s canonical human form, plus every alias spelling attested for it { canonical, components, urn }
reject the corpus’s negative fixtures (inputs the reference refuses) none

Alias spellings are attested as inputs: the expectation is still the one canonical identity, reached in a single parse. A spelling that the reference normalizes over several rounds is a legitimate hard row — it measures one-shot normalization, not round-limited parsing.

Rejection rows are inputs attested to be rejected under the flavor — including inputs valid under some other publisher (an EN standard under the iso grammar, for instance): the flavor label is part of the task.

Dataset shape and versioning

The dataset is JSONL — one row per line:

{"id":"iso.amendment.0009","input":"IEC 62304:2006/Amd 1:2015","flavor":"iso","kind":"parse","expected":{"canonical":"IEC 62304:2006/Amd 1:2015","components":{"_type":"pubid:iso:amendment","number":"1","year":"2015","publisher":"IEC","base":{"_type":"pubid:iso:international-standard","number":"62304","year":"2006","publisher":"IEC"}},"urn":"urn:iso:std:iec:62304:amd:1:2015:v1"}}
{"id":"iso.neg.international_standard.0001","input":"EN 12643:2014","flavor":"iso","kind":"reject","expected":null,"error_code":"unclassified"}

Versioning is by the pubid-testsuite commit the rows were exported from. The file name carries the short commit (pubid-benchmark-<sha>.jsonl), the manifest (schema pubid-benchmark/manifest@1) records the full commit and the dataset’s SHA-256, and row counts per flavor. The export (scripts/export-benchmark.mjs) reads only the corpus’s committed payloads — it never parses identifiers itself — so a re-run at the same corpus commit is byte-identical.

Excluded, and counted in the manifest (never silently dropped):

The corpus grows by the flywheel (attestation rounds per publisher); each corpus update produces a new dataset version, and scores are valid per dataset version.

Metrics

All metrics are computed by the evaluator over the whole dataset: a row absent from a predictions file is unattempted and counts as a miss on every metric — a submission cannot score by cherry-picking. The evaluated block of the score JSON records attempted/unattempted so coverage is always visible.

1. Canonical exact match

Over parse rows: the prediction is a parse and its canonical equals the expected canonical render byte-exact — no case folding, no space normalization, no Unicode folding.

2. Typed-component F1

Over parse rows that carry components: micro-averaged F1 over component slots. A slot is one top-level key of the expected components object (for the example row above: _type, number, year, publisher, base — five slots). A predicted slot matches when the key exists in the expected components and the values are equal after normalization: objects compare key-sorted, arrays compare order-sensitively, scalars compare exactly.

F1 = 2·TP / (2·TP + FP + FN), summed over all rows. A parse row predicted as reject contributes every expected slot as false negatives.

Worked example: an engine answers the row above with canonical correct and components {_type, number, year, publisher, base, month: "06"} — five matches and one spurious month slot: TP 5, FP 1, FN 0 from this row, folded into the global counts.

A component prediction may be produced however the engine resolves its identity — in particular by re-parsing its own predicted canonical render (the same canonicalization the corpus applies). Both the direct parse’s facets and the re-parse’s identity components are accepted inputs to the metric; only the values are compared.

3. URN round-trip accuracy

Over parse rows whose expected urn is non-null: the predicted urn equals the expected URN byte-exact. Rows with no expected URN (flavors without an URN emission, or identities with none attested) are outside this metric; urn_rows in the score states the denominator. A missing, null, or mismatched URN is a miss.

4. Rejection accuracy

Over reject rows: the prediction is reject. Any rejection counts — the corpus’s error codes are diagnostic, not scored.

5. False rejection rate (informational)

Over parse rows: the fraction predicted as reject. It is reported because a trivially-all-reject engine maximizes rejection accuracy while scoring zero elsewhere; the canonical metric already punishes it.

The evaluator

The protocol has one implementation: scripts/evaluate-benchmark.mjs in the site repository. It takes the dataset and a predictions file and writes a score JSON (pubid-benchmark/score@1) with the five metrics, the slot tallies, and the full per-flavor breakdown. Unknown prediction ids abort the run — a mismatched submission is an error, not a low score.

Terminal window
$ node scripts/evaluate-benchmark.mjs \
--dataset public/benchmark/dataset/pubid-benchmark-<sha>.jsonl \
--predictions predictions.jsonl \
--submitter "Example Engine" --engine example --engine-version 1.0.0 \
--engine-language rust --out score.json

Submission format

A submission is a predictions JSONL file — one row per attempted dataset row:

{"id":"iso.amendment.0009","kind":"parse","canonical":"IEC 62304:2006/Amd 1:2015","components":{"_type":"pubid:iso:amendment","number":"1","year":"2015","publisher":"IEC","base":{"_type":"pubid:iso:international-standard","number":"62304","year":"2006","publisher":"IEC"}},"urn":"urn:iso:std:iec:62304:amd:1:2015:v1"}
{"id":"iso.neg.international_standard.0001","kind":"reject"}

id must be the dataset row’s id. components is optional (a parse without components scores FN on all its slots); urn is optional (null or absent is a URN miss on rows with an expected URN).

To enter the leaderboard: open a pull request against pubid/pubid.github.io adding src/data/benchmark/scores/<engine>.json (the evaluator’s output, with submitter, engine name/version/language filled in). The PR is reviewed for provenance — state how the predictions were produced (engine version, probe or harness) — and merged; the leaderboard page reads the committed scores at build time.

Reference entries

The pubid engines’ own scores are committed as the reference entries, produced by the committed probes: the Ruby engine over a checkout (scripts/probe-ruby-benchmark.rb), the Rust engine over its CLI binary (scripts/probe-rust-benchmark.mjs), the TypeScript engine over the published npm package (scripts/probe-ts-benchmark.mjs). See the leaderboard.

Citing

The dataset is archived on Zenodo for citability.

Dataset DOI (Zenodo): 10.5281/zenodo.PUBID-BENCHMARK — placeholder; the DOI minting is a separate step and is pending. Until minted, cite the dataset by corpus commit: pubid/pubid-testsuite@8310447b8461438d3eee1c76f7d862c6324047ec (SHA-256 of the dataset file in the manifest).