-
Notifications
You must be signed in to change notification settings - Fork 991
Context in recognizer YAML is ignored when scoring matches #1696
Copy link
Copy link
Labels
analyzerbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Describe the bug
When using a custom recognizer defined in YAML with a context field, the context words are ignored in scoring. The match score remains at the base pattern score instead of being boosted by the context.
To Reproduce
- Create a custom recognizer YAML:
- name: "Date of Birth Recognizer"
type: custom
supported_languages:
- en
patterns:
- name: "DOB without slashes"
regex: "(\b(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\b)"
score: 0.8
context:
- DOB
supported_entity: "DATE_TIME"
- Load it into Presidio and run:
res = analyzer.analyze(
text="DOB: 19571012",
language="en",
return_decision_process=True
)
- Observe the match score.
It's 0.8, instead of 1.
Expected behavior
The context DOB should boost the score from 0.8 to 1.0.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
analyzerbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers