Anonymizer
BaseTextAnonymizer is an abstract class that defines the interface for anonymizing text.
References
NONE
BaseTextAnonymizer
Bases: Component
, ABC
Anonymizer class to anonymize the text.
anonymize(text, entities=None, language='id', conflict_resolution=None, analyzer_score_threshold=0.46)
abstractmethod
Anonymize the text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
The text to be anonymized. |
required |
entities |
list[str] | None
|
The list of entities to be anonymized. Default is None. |
None
|
language |
str
|
The language of the text to be analyzed. Default is "id". |
'id'
|
conflict_resolution |
ConflictResolutionStrategy | None
|
The conflict resolution strategy. Default is None. |
None
|
analyzer_score_threshold |
float
|
The score threshold for the analyzer, default is 0.46. |
0.46
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The anonymized text |
deanonymize(text)
abstractmethod
Deanonymize the text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
The text to be deanonymized |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The deanonymized text |
Operation
Bases: StrEnum
Enum represent the valid operation for the anonymizer.