contains_pii_entities

Comprehend.Client.contains_pii_entities(**kwargs)

Analyzes input text for the presence of personally identifiable information (PII) and returns the labels of identified PII entity types such as name, address, bank account number, or phone number.

See also: AWS API Documentation

Request Syntax

response = client.contains_pii_entities(
    Text='string',
    LanguageCode='en'|'es'|'fr'|'de'|'it'|'pt'|'ar'|'hi'|'ja'|'ko'|'zh'|'zh-TW'
)
Parameters
  • Text (string) --

    [REQUIRED]

    A UTF-8 text string. The maximum string size is 100 KB.

  • LanguageCode (string) --

    [REQUIRED]

    The language of the input documents. Currently, English is the only valid language.

Return type

dict

Returns

Response Syntax

{
    'Labels': [
        {
            'Name': 'BANK_ACCOUNT_NUMBER'|'BANK_ROUTING'|'CREDIT_DEBIT_NUMBER'|'CREDIT_DEBIT_CVV'|'CREDIT_DEBIT_EXPIRY'|'PIN'|'EMAIL'|'ADDRESS'|'NAME'|'PHONE'|'SSN'|'DATE_TIME'|'PASSPORT_NUMBER'|'DRIVER_ID'|'URL'|'AGE'|'USERNAME'|'PASSWORD'|'AWS_ACCESS_KEY'|'AWS_SECRET_KEY'|'IP_ADDRESS'|'MAC_ADDRESS'|'ALL'|'LICENSE_PLATE'|'VEHICLE_IDENTIFICATION_NUMBER'|'UK_NATIONAL_INSURANCE_NUMBER'|'CA_SOCIAL_INSURANCE_NUMBER'|'US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER'|'UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER'|'IN_PERMANENT_ACCOUNT_NUMBER'|'IN_NREGA'|'INTERNATIONAL_BANK_ACCOUNT_NUMBER'|'SWIFT_CODE'|'UK_NATIONAL_HEALTH_SERVICE_NUMBER'|'CA_HEALTH_NUMBER'|'IN_AADHAAR'|'IN_VOTER_NUMBER',
            'Score': ...
        },
    ]
}

Response Structure

  • (dict) --

    • Labels (list) --

      The labels used in the document being analyzed. Individual labels represent personally identifiable information (PII) entity types.

      • (dict) --

        Specifies one of the label or labels that categorize the personally identifiable information (PII) entity being analyzed.

        • Name (string) --

          The name of the label.

        • Score (float) --

          The level of confidence that Amazon Comprehend has in the accuracy of the detection.

Exceptions

  • Comprehend.Client.exceptions.InvalidRequestException
  • Comprehend.Client.exceptions.TextSizeLimitExceededException
  • Comprehend.Client.exceptions.UnsupportedLanguageException
  • Comprehend.Client.exceptions.InternalServerException