Definitions Module
anonipy.definitions
Module containing the definitions
.
The definitions
module provides a set of predefined types used in the package.
Classes:
Name | Description |
---|---|
Entity |
The class representing the anonipy entity object. |
Replacement |
The class representing the anonipy replacement object. |
Entity
dataclass
The class representing the anonipy Entity object.
Attributes:
Name | Type | Description |
---|---|---|
text |
str
|
The text of the entity. |
label |
str
|
The label of the entity. |
start_index |
int
|
The start index of the entity in the text. |
end_index |
int
|
The end index of the entity in the text. |
score |
float
|
The prediction score of the entity. The score is returned by the extractor models. |
type |
ENTITY_TYPES
|
The type of the entity. |
regex |
Union[str, Pattern]
|
The regular expression the entity must match. |
Source code in anonipy/definitions.py
get_regex_group()
Get the regex group.
Returns:
Type | Description |
---|---|
Union[str, None]
|
The regex group. |
Replacement
Bases: TypedDict
The class representing the anonipy Replacement object.
Attributes:
Name | Type | Description |
---|---|---|
original_text |
str
|
The original text of the entity. |
label |
str
|
The label of the entity. |
start_index |
int
|
The start index of the entity in the text. |
end_index |
int
|
The end index of the entity in the text. |
anonymized_text |
str
|
The anonymized text replacing the original. |