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

Addition of leniency parameter in predefined PhoneRecognizer #1311

Merged
merged 3 commits into from
Feb 24, 2024

Conversation

VMD7
Copy link
Contributor

@VMD7 VMD7 commented Feb 23, 2024

Addition of leniency parameter in predefined PhoneRecognizer

Change Description

-> The PhoneRecognizer failed to detect phone numbers when they appeared without any space between text and number, as seen in cases like testdata630-596-1111.

-> Internally, the PhoneRecognizer utilizes the phonenumbers library for phone number detection. This library offers a parameter known as leniency, which determines the flexibility of the phone number format. The leniency parameter ranges from 0 to 3, with higher values indicating more strict phone number format match.

-> Initially, the leniency factor in PhoneRecognizer was set to 1, causing it to overlook phone numbers lacking spaces between text and digits. To address this issue, we've enhanced PhoneRecognizer to allow users to adjust the leniency parameter according to their requirements, with a default value of 1.

-> This enhancement resolves various phone number format issues and empowers users to tailor its behavior to their specific needs.

Issue reference

This PR fixes issue #1301

Checklist

  • I have reviewed the contribution guidelines
  • I have signed the CLA (if required)
  • My code includes unit tests
  • All unit tests and lint checks pass locally
  • My PR contains documentation updates / additions if required

Copy link
Contributor

@omri374 omri374 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@omri374
Copy link
Contributor

omri374 commented Feb 24, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@omri374
Copy link
Contributor

omri374 commented Feb 24, 2024

Could be relevant to revisit #772. The phone number recognizer makes some assumptions, such as the regions it looks for phone numbers for (as it is slower to search all of the regions) and other hyperparameters such as leniency.

@omri374 omri374 merged commit 4c48b92 into microsoft:main Feb 24, 2024
31 checks passed
@VMD7
Copy link
Contributor Author

VMD7 commented Feb 24, 2024

Yes sure, will go through it.

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

Successfully merging this pull request may close these issues.

2 participants