Addition of leniency parameter in predefined PhoneRecognizer #1311
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addition of
leniency
parameter in predefinedPhoneRecognizer
Change Description
-> The
PhoneRecognizer
failed to detect phone numbers when they appeared without any space between text and number, as seen in cases liketestdata630-596-1111
.-> Internally, the
PhoneRecognizer
utilizes the phonenumbers library for phone number detection. This library offers a parameter known asleniency
, which determines the flexibility of the phone number format. The leniency parameter ranges from0 to 3
, with higher values indicating more strict phone number format match.-> Initially, the leniency factor in
PhoneRecognizer
was set to1
, 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 of1
.-> 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