PhoneRecognizer returns incorrect recognizer name in the analysis_explanation
egillv021 opened this issue · 2 comments
Describe the bug
The PhoneRecognizer currently returns 'ABCMeta' as the recognizer in the analysis_explaination
{ 'original_score': 0.4,
'pattern': None,
'pattern_name': None,
'recognizer': 'ABCMeta',
'regex_flags': None,
'score': 0.75,
'score_context_improvement': 0.35,
'supportive_context_word': 'phone',
'textual_explanation': 'Recognized as BR region phone number, using '
'PhoneRecognizer',
'validation_result': None}
To Reproduce
Steps to reproduce the behavior:
- install presidio in a python environment
- run the following script:
from presidio_analyzer import AnalyzerEngine
import pprint
analyzer = AnalyzerEngine()
text = "You can reach me via phone at 555-123-4567 tomorrow."
results = analyzer.analyze(text=text, language="en", return_decision_process=True)
print("Original Text:\n", text)
for result in results:
decision_process = result.analysis_explanation
if decision_process:
pp = pprint.PrettyPrinter(indent=4)
print("Decision process output:")
pp.pprint(decision_process.__dict__)
Expected behavior
The recognizer should be set to 'PhoneRecognizer' that's the behaviour of other recognizers.
Additional context
I have a simple fix for it and would be happy to submit a PR that fixes this.
Thanks @egillv021! I'd be happy to review your PR.