Skip to content

perf(coreference): avoid rebuilding growing regex alternations - #92

Open
mazzasaverio wants to merge 4 commits into
ma2za:mainfrom
mazzasaverio:perf/coreference-token-lookup
Open

mazzasaverio wants to merge 4 commits into
ma2za:mainfrom
mazzasaverio:perf/coreference-token-lookup

Conversation

@mazzasaverio

@mazzasaverio mazzasaverio commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Coreference detection rebuilt a regex alternation containing every learned token for every block. Replace that with a Unicode word scan and exact dictionary lookup, preserving offsets, case, confidence and boundaries. Add generated equivalence tests and a comparative benchmark at 100, 1,000 and 10,000 tokens. Large scopes improve locally; small scopes can be slightly slower.

Validation: 6 focused tests and 6 benchmark cases passed. Full CI passed 527 tests per matrix job with 95.00% to 95.07% coverage, plus quality, docs, performance, property, packaging and installed-wheel checks: https://github.com/ma2za/pseudonymize/actions/runs/36972557134 . No detection-quality improvement is claimed.

Current review status

Review priority: 6 of 9; PR #100 is the packaging prerequisite. Updated against main 17e8fcc while preserving development version 1.37.0 and the hosted-service changes. Includes the shared service-extra audit correction from #100. No PR has been merged.

Current branch validation: 17 focused tests passed; Ruff formatting/lint, mypy, wheel/sdist builds and release verification passed. All six comparative coreference benchmark cases passed; these measure lookup cost and do not establish a detection-quality improvement. Fresh CI on the current head completed with 18 successful checks, one skipped check, and no failures.

@mazzasaverio
mazzasaverio marked this pull request as ready for review October 2, 2026 06:18
@mazzasaverio
mazzasaverio requested a review from ma2za as a code owner October 2, 2026 06:18

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants