fix: handle multiple GLiNER labels share the same span - #238
Conversation
Greptile SummaryThe PR changes exact-span overlap resolution to prefer the highest-scoring GLiNER label and adds a regression test for that behavior. It also extends sealed W&B imports with benchmark identity metadata and updates credential handling.
Confidence Score: 4/5The PR is not yet safe to merge because occurrence expansion still replaces original detector provenance with synthetic propagation metadata. The score-based overlap ordering applies to both detector results and score-1.0 propagation copies; when expansion recreates an original occurrence, the synthetic copy wins and its source and score are emitted in final_entities. Files Needing Attention: src/anonymizer/engine/detection/postprocess.py and tests/engine/test_detection_postprocess.py Important Files Changed
|
Signed-off-by: asteier2026 <asteier@nvidia.com>
…he same span resolve_overlaps previously used alphabetical label order as a tiebreaker for exact-span matches, causing higher-scoring labels like relationship (0.941) to be dropped in favour of lower-scoring ones like last_name (0.719). Adding -score before label in the sort key ensures the highest-confidence label wins. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: asteier2026 <asteier@nvidia.com>
5bb4fd6 to
06e5aaa
Compare
Summary
resolve_overlapspreviously used alphabetical label order as the final tiebreaker when two GLiNER detections shared the exact same character span, causing higher-confidence labels to be silently dropped in favour of lower-confidence ones.-item.scoreto the sort key (beforeitem.label) so the highest-scoring label wins on exact-span ties.Example:
"Mum"was tagged as bothrelationship(score 0.941) andlast_name(score 0.719). Before this fix,last_namewon becausel<ralphabetically. After,relationshipcorrectly wins.Test plan
test_detection_postprocess.pyparametrized test covers the new behaviour — verify it passes withmake testrelationshipentities surface correctly🤖 Generated with Claude Code