Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhoneRecognizer returns incorrect recognizer name in the analysis_explanation #1330

Closed
egillv021 opened this issue Mar 14, 2024 · 2 comments
Closed

Comments

@egillv021
Copy link
Contributor

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:

  1. install presidio in a python environment
  2. 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.

@omri374
Copy link
Contributor

omri374 commented Mar 14, 2024

Thanks @egillv021! I'd be happy to review your PR.

@egillv021
Copy link
Contributor Author

Thanks @omri374 I really appreciate it!

@omri374 omri374 closed this as completed Mar 17, 2024
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

No branches or pull requests

2 participants