-
Notifications
You must be signed in to change notification settings - Fork 603
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
Enable regex flags manipulation #1193
Conversation
# Conflicts: # mkdocs.yml # presidio-analyzer/Pipfile # presidio-analyzer/conf/default.yaml # presidio-analyzer/conf/spacy.yaml # presidio-analyzer/conf/spacy_multilingual.yaml # presidio-analyzer/conf/stanza.yaml # presidio-analyzer/conf/stanza_multilingual.yaml # presidio-analyzer/conf/transformers.yaml # presidio-analyzer/tests/conf/default.yaml # presidio-analyzer/tests/test_stanza_recognizer.py
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -37,9 +39,9 @@ def __init__( | |||
deny_list: List[str] = None, | |||
context: List[str] = None, | |||
deny_list_score: float = 1.0, | |||
global_regex_flags: Optional[int] = re.DOTALL | re.MULTILINE | re.IGNORECASE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty bad. You just change the default value from re.DOTALL | re.MULTILINE
to re.DOTALL | re.MULTILINE | re.IGNORECASE
.
This affect us as a client of this library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ducquangkstn thanks for the feedback. This change allows you to have more customizability with regards to regex flags. Is this blocking you in any way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this blocking you in any way?
Actually, no. It just took me a while to figure out why the behavior is changed when pumping presidio version.
We (my company) are lucky that we have some unit tests. Not sure about other ppl.
Change Description
As a user I would like to customize the regex flags used by Presidio, to be able to pass flags not defined initially.
Regex flags can be set on the
PatternRecognizer
's constructor, or in theRecognizerRegistry
constructor to support all existingPatternRecognizer
s:Issue reference
This PR fixes issue #1029
Checklist