Fix: Context boosting in YAML recognizers (#1696)#1705
Fix: Context boosting in YAML recognizers (#1696)#1705MRADULTRIPATHI wants to merge 1 commit intomicrosoft:mainfrom
Conversation
|
@microsoft-github-policy-service agree |
|
Hi @maintainers, I’ve signed the CLA ✅ and all checks have passed. |
|
Thanks for this PR. The context awareness flow takes place after each recognizer analyzes the text, and is decoupled from the recognition logic. Closing this PR as this creates a dependency between the Pattern Recognizer and the context enhancer. I believe that the problem in issue 1696 is a configuration problem and not a problem with Presidio's logic, as this flow works if defined in code. |
|
Thanks for the clarification! Could you please guide on how to properly configure context boosting when using a custom recognizer defined in YAML? Happy to adjust my PR or contribute to docs if needed. |
Change Description
This PR fixes an issue where custom recognizers defined in YAML with a
contextfield did not properly boost the detection score.Previously, the match score stayed at the base pattern score (e.g.,
0.8) even when the context word (e.g., "DOB") was present.Now, the recognizer correctly applies context boosting so that the score is raised (e.g., from
0.8→1.0) when context terms are detected near the entity.Issue reference
Fixes #1696
Checklist
Example (Before → After)
Before:
Entity: DATE_TIME, Score: 0.8
After:
Entity: DATE_TIME, Score: 1.0