-
Notifications
You must be signed in to change notification settings - Fork 524
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
changing predefined recognizers to use the config file #1393
base: main
Are you sure you want to change the base?
Conversation
presidio-analyzer/presidio_analyzer/recognizer_registry/recognizer_registry_provider.py
Outdated
Show resolved
Hide resolved
if languages is not None: | ||
registry_configuration["supported_languages"] = languages | ||
|
||
recognizers = RecognizerRegistryProvider( |
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.
I know this is working, but it feels like a weakspot. Is it complex to extract this to an external module that both this class and RecognizerRegistryProvoder
uses?
registry_configuration=registry_configuration | ||
).create_recognizer_registry().recognizers | ||
|
||
self.recognizers.extend(recognizers) |
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.
Worth checking for duplications. Isn't the nlp provider added twice?
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.
recognizer_registry
doesn't add the nlp recognizer, so there's no duplication. In fact when the analyzer get initialized without a registry we do the following:
if not registry:
logger.info("registry not provided, creating default.")
provider = RecognizerRegistryProvider(
registry_configuration={"supported_languages": self.supported_languages}
)
registry = provider.create_recognizer_registry()
registry.add_nlp_recognizer(nlp_engine=self.nlp_engine)
Which is basically this function now :D
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.
Wouldn't it add it if it's in the yaml?
presidio-analyzer/presidio_analyzer/recognizer_registry/recognizer_registry_provider.py
Outdated
Show resolved
Hide resolved
presidio-analyzer/presidio_analyzer/recognizer_registry/recognizer_registry_provider.py
Outdated
Show resolved
Hide resolved
Fixed docs Co-authored-by: Omri Mendels <[email protected]>
Change Description
This PR is going to accomplish the following:
Checklist