Skip to content

Constants

gllm_privacy.pii_detector.constants

Constants used in the pii_detector module.

Authors

Muhammad Afif Al Hawari (muhammad.a.a.hawari@gdplabs.id) Muhammad Hakim Asy'ari (muhammad.h.asyari@gdplabs.id)

References

NONE

DEFAULT_PROSA_SUPPORTED_PII_ENTITIES = [Entities.PERSON, Entities.ORGANIZATION_NAME, Entities.LOCATION] module-attribute

GLLM_PRIVACY_ENTITIES = tuple(entity.value for entity in Entities) module-attribute

PROSA_ENTITY_MAP = {'OTN': Entities.OTHER_NAME, 'PER': Entities.PERSON, 'GOD': Entities.GOD, 'ORG': Entities.ORGANIZATION_NAME, 'LOC': Entities.LOCATION, 'FAC': Entities.FACILITY, 'PRO': Entities.PRODUCT, 'EVT': Entities.EVENT, 'TME': Entities.TIME, 'DTE': Entities.DATE_TIME, 'NUM': Entities.NUMBER, 'MEA': Entities.MEASUREMENT} module-attribute

RecognizerResult = PresidioRecognizerResult module-attribute

Entities

Bases: StrEnum

Supported entities for PII detection.

BANK_ACCOUNT = 'BANK_ACCOUNT' class-attribute instance-attribute

CREDIT_CARD = 'CREDIT_CARD' class-attribute instance-attribute

CRYPTO = 'CRYPTO' class-attribute instance-attribute

DATE_TIME = 'DATE_TIME' class-attribute instance-attribute

EMAIL_ADDRESS = 'EMAIL_ADDRESS' class-attribute instance-attribute

EMPLOYEE_ID = 'EMPLOYEE_ID' class-attribute instance-attribute

EVENT = 'EVENT' class-attribute instance-attribute

FACEBOOK_ACCOUNT = 'FACEBOOK_ACCOUNT' class-attribute instance-attribute

FACILITY = 'FACILITY' class-attribute instance-attribute

FAMILY_CARD_NUMBER = 'FAMILY_CARD_NUMBER' class-attribute instance-attribute

GOD = 'GOD' class-attribute instance-attribute

IBAN_CODE = 'IBAN_CODE' class-attribute instance-attribute

ID_BPJS_NUMBER = 'ID_BPJS_NUMBER' class-attribute instance-attribute

IP_ADDRESS = 'IP_ADDRESS' class-attribute instance-attribute

KTP = 'ID_KTP' class-attribute instance-attribute

LINKEDIN_ACCOUNT = 'LINKEDIN_ACCOUNT' class-attribute instance-attribute

LOCATION = 'LOCATION' class-attribute instance-attribute

MEASUREMENT = 'MEASUREMENT' class-attribute instance-attribute

MEDICAL_LICENSE = 'MEDICAL_LICENSE' class-attribute instance-attribute

MONEY = 'MONEY' class-attribute instance-attribute

NPWP = 'ID_NPWP' class-attribute instance-attribute

NRP = 'NRP' class-attribute instance-attribute

NUMBER = 'NUMBER' class-attribute instance-attribute

ORGANIZATION_NAME = 'ORGANIZATION' class-attribute instance-attribute

OTHER_NAME = 'OTHER_NAME' class-attribute instance-attribute

PERSON = 'PERSON' class-attribute instance-attribute

PHONE_NUMBER = 'PHONE_NUMBER' class-attribute instance-attribute

PRODUCT = 'PRODUCT' class-attribute instance-attribute

PROJECT = 'PROJECT' class-attribute instance-attribute

TIME = 'TIME' class-attribute instance-attribute

URL = 'URL' class-attribute instance-attribute

US_BANK_NUMBER = 'US_BANK_NUMBER' class-attribute instance-attribute

US_DRIVER_LICENSE = 'US_DRIVER_LICENSE' class-attribute instance-attribute

US_ITIN = 'US_ITIN' class-attribute instance-attribute

US_PASSPORT = 'US_PASSPORT' class-attribute instance-attribute

US_SSN = 'US_SSN' class-attribute instance-attribute

ProsaNERConstant

Defines constants used in the Prosa NER integration.

This class encapsulates various constants that are utilized throughout the Prosa Named Entity Recognition (NER) integration process. These include API headers, API payload keys and values, entity recognition response keys, and default values for entity recognition processing.

Attributes:

Name Type Description
HEADER_CONTENT_TYPE_KEY str

Key for the content type header.

HEADER_CONTENT_TYPE_VAL str

Value for the 'Content-Type' header, typically 'application/json'.

HEADER_USER_AGENT str

Key for the user agent header.

HEADER_USER_AGENT_VAL str

Value for User-Agent HTTP header for request.

ID_LANGUAGE str

Language code for Indonesian language, used in language-specific operations.

VERSION_CUSTOM_NER str

Version identifier for the custom NER being used.

PAYLOAD_VERSION_KEY str

Key for specifying the version in the API payload.

PAYLOAD_VERSION_VAL str

Value for the API version, typically 'v1'.

PAYLOAD_TEXT_KEY str

Key for the text to be analyzed in the API payload.

RESPONSE_TIMEOUT int

Timeout value for the API response, in seconds.

ENTITY_TYPE_KEY str

Key for the entity type in entity dictionaries.

START_KEY str

Key for the start index of an entity in the text.

START_IDX_KEY str

Key for the start index of an entity in the text returned by Prosa.

END_KEY str

Key for the end index of an entity in the text.

SCORE_KEY str

Key for the confidence score of the entity recognition.

DEFAULT_SCORE float

Default score assigned to recognized entities if not provided.

RECOGNITION_METADATA_KEY str

Key for additional metadata associated with recognized entities.

NAME_KEY str

Key for the entity's name within the recognition metadata.

ENTITY_KEY str

Key for accessing entity string from the API response.

DEFAULT_SCORE: float = 0.5 class-attribute instance-attribute

END_KEY: str = 'end' class-attribute instance-attribute

ENTITY_KEY: str = 'type' class-attribute instance-attribute

ENTITY_TYPE_KEY: str = 'entity_type' class-attribute instance-attribute

HEADER_CONTENT_TYPE_KEY: str = 'Content-Type' class-attribute instance-attribute

HEADER_CONTENT_TYPE_VAL: str = 'application/json' class-attribute instance-attribute

HEADER_USER_AGENT: str = 'User-Agent' class-attribute instance-attribute

HEADER_USER_AGENT_VAL: str = 'GLLM-Privacy' class-attribute instance-attribute

HEADER_X_API_KEY_KEY: str = 'x-api-key' class-attribute instance-attribute

ID_LANGUAGE: str = 'id' class-attribute instance-attribute

LENGTH_KEY: str = 'length' class-attribute instance-attribute

NAME_KEY: str = 'name' class-attribute instance-attribute

PAYLOAD_TEXT_KEY: str = 'text' class-attribute instance-attribute

PAYLOAD_VERSION_KEY: str = 'version' class-attribute instance-attribute

PAYLOAD_VERSION_VAL: str = 'v2' class-attribute instance-attribute

RECOGNITION_METADATA_KEY: str = 'recognition_metadata' class-attribute instance-attribute

RESPONSE_TIMEOUT: int = 100 class-attribute instance-attribute

SCORE_KEY: str = 'score' class-attribute instance-attribute

START_IDX_KEY: str = 'begin_offset' class-attribute instance-attribute

START_KEY: str = 'start' class-attribute instance-attribute

VERSION_CUSTOM_NER: str = '1.0' class-attribute instance-attribute