feat(analyzer): Add golden-dataset evaluation harness with per-PR quality report#2172
Open
yuriihavrylko wants to merge 7 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Description
Adds a span-level evaluation harness that gives every PR a per-entity precision/recall/F1 and latency report for the analyzer, so recognizer and pipeline changes are reviewed with numbers instead of intuition.
What's included
generate_golden_en.py) so span offsets are computed, never hand-counted; a sync test fails if the JSON drifts from the generator.--iou 1.0= exact), aggregates per-entity TP/FP/FN into precision/recall/F1, measures throughput, and renders a markdown report including every mismatch with its text for human review.baselines/spacy_en.json) turns the report into per-entity F1 deltas.--fail-on-regressionexits non-zero when overall or per-entity F1 drops more than--f1-tolerance(default 0.02). CI runs report-only: flipping enforcement on is a one-line change, deliberately left as a maintainer decision once the numbers have proven stable across real PRs (e.g. a newen_core_web_lgrelease can shift NER results with no code change).--analyzer-conf <yaml>with their own baselines; wiring them into a nightly matrix is a follow-up.Why this shape
AnalyzerEngine.analyze()end-to-end catches what unit tests structurally can't — a new recognizer's regex firing on other entities' values, a registry refactor silently dropping a recognizer (entity recall → 0), NLP model/label-mapping shifts, threshold plumbing changes.The report already surfaces known issues — current baseline: precision 0.724, recall 0.989, F1 0.836. URL false positives inside email addresses (#1498, #1316) show as URL precision 0.292;
PHONE_NUMBERfires on SSNs and IPs; spaCy tags bare numbers asDATE_TIME.Roadmap (details in
tests/evaluation/README.md): this PR → switch on--fail-on-regressionin CI → synthetic template+Faker data generation, with templates required for new recognizers (#1639) → nightly multi-config matrix (transformers/GLiNER/LLM) and non-English datasets, feeding the fast/balanced/accurate recipes comparison (#1809).Issue reference
Fixes #1810
Advances #1639 (phase 1 of the evaluation roadmap); groundwork for #1809
Checklist