Amazon Comprehend

2021/03/11 - Amazon Comprehend - 1 new api methods

Changes  Update comprehend client to latest version

ContainsPiiEntities (new) Link ΒΆ

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

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

string

param Text:

[REQUIRED]

Creates a new document classification request to analyze a single document in real-time, returning personally identifiable information (PII) entity labels.

type LanguageCode:

string

param LanguageCode:

[REQUIRED]

The language of the input documents.

rtype:

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',
            '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.