mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-27 00:48:45 +00:00
Temporarily remove language selection (#10097)
Adapting Microsoft Presidio to other languages requires a bit more work, so for now it will be good idea to remove the language option to choose, so as not to cause errors and confusion. https://microsoft.github.io/presidio/analyzer/languages/ I will handle different languages after the weekend 😄
This commit is contained in:
parent
71c418725f
commit
b5a74fb973
@ -18,14 +18,12 @@ class PresidioAnonymizer(AnonymizerBase):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
analyzed_fields: Optional[List[str]] = None,
|
analyzed_fields: Optional[List[str]] = None,
|
||||||
language: str = "en",
|
|
||||||
operators: Optional[Dict[str, OperatorConfig]] = None,
|
operators: Optional[Dict[str, OperatorConfig]] = None,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
analyzed_fields: List of fields to detect and then anonymize.
|
analyzed_fields: List of fields to detect and then anonymize.
|
||||||
Defaults to all entities supported by Microsoft Presidio.
|
Defaults to all entities supported by Microsoft Presidio.
|
||||||
language: Language to use for analysis. Defaults to english.
|
|
||||||
operators: Operators to use for anonymization.
|
operators: Operators to use for anonymization.
|
||||||
Operators allow for custom anonymization of detected PII.
|
Operators allow for custom anonymization of detected PII.
|
||||||
Learn more:
|
Learn more:
|
||||||
@ -54,7 +52,6 @@ class PresidioAnonymizer(AnonymizerBase):
|
|||||||
if analyzed_fields is not None
|
if analyzed_fields is not None
|
||||||
else list(get_pseudoanonymizer_mapping().keys())
|
else list(get_pseudoanonymizer_mapping().keys())
|
||||||
)
|
)
|
||||||
self.language = language
|
|
||||||
self.operators = (
|
self.operators = (
|
||||||
operators
|
operators
|
||||||
if operators is not None
|
if operators is not None
|
||||||
@ -72,7 +69,7 @@ class PresidioAnonymizer(AnonymizerBase):
|
|||||||
results = self._analyzer.analyze(
|
results = self._analyzer.analyze(
|
||||||
text,
|
text,
|
||||||
entities=self.analyzed_fields,
|
entities=self.analyzed_fields,
|
||||||
language=self.language,
|
language="en",
|
||||||
)
|
)
|
||||||
|
|
||||||
return self._anonymizer.anonymize(
|
return self._anonymizer.anonymize(
|
||||||
|
Loading…
Reference in New Issue
Block a user