Add local benchmark harness for v0.2.2 - #13
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ad0e23992a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| mention_map.setdefault(mention.paragraph_id, []).append(mention.normalized) | ||
|
|
||
| preview: list[dict[str, Any]] = [] | ||
| for paragraph, labels in zip(paragraphs[:limit], result.paragraph_labels[:limit], strict=True): |
There was a problem hiding this comment.
Build preview from cleaned result paragraphs
build_preview zips the original input paragraphs with result.paragraph_labels using strict=True, but the pipeline can drop records during technical cleanup (for example, URL-only text becomes empty). In that case these lists diverge and the benchmark run crashes with ValueError when generating the summary preview; even before crashing, IDs/text can be paired with the wrong labels if any earlier paragraph was dropped. Use the post-cleaning paragraph list from the result when constructing preview rows.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 42d18c8.
The benchmark preview now uses result.paragraphs, which reflects the cleaned paragraph list that actually entered the pipeline, instead of zipping against the raw input list. That avoids both the strict=True length mismatch and any source/text-to-label misalignment when cleanup drops records. I also added a regression test that covers an input where one paragraph is removed during cleanup.
Summary
This PR is the benchmark-harness slice for
v0.2.2.The main goal is to add a lightweight, repeatable local benchmark workflow for comparing extractor behavior across heuristic, spaCy, and provider-backed LLM runs without coupling the package to one repository-managed raw dataset pipeline.
Included
adds a local benchmark runner under
benchmark/jsonandjsonlbenchmark inputstextfor each recordidheuristic,spacy, andllmbenchmark runsadds a benchmark result summarizer
adds focused benchmark harness coverage
jsonandjsonlidhandling with requiredtextValidation
Repository checks:
ruff check .pyrightpytest -qTargeted checks:
pytest -q tests/test_benchmark.pyNotes
experiment/benchmark/directory is development-only and remains outside the package build targets