:doc:`Comprehend <../../comprehend>` / Client / detect_pii_entities

*******************
detect_pii_entities
*******************



.. py:method:: Comprehend.Client.detect_pii_entities(**kwargs)

  

  Inspects the input text for entities that contain personally identifiable information (PII) and returns information about them.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/comprehend-2017-11-27/DetectPiiEntities>`_  


  **Request Syntax**
  ::

    response = client.detect_pii_entities(
        Text='string',
        LanguageCode='en'|'es'|'fr'|'de'|'it'|'pt'|'ar'|'hi'|'ja'|'ko'|'zh'|'zh-TW'
    )
    
  :type Text: string
  :param Text: **[REQUIRED]** 

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

    

  
  :type LanguageCode: string
  :param LanguageCode: **[REQUIRED]** 

    The language of the input text. Enter the language code for English (en) or Spanish (es).

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'Entities': [
              {
                  'Score': ...,
                  'Type': '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',
                  'BeginOffset': 123,
                  'EndOffset': 123
              },
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Entities** *(list) --* 

        A collection of PII entities identified in the input text. For each entity, the response provides the entity type, where the entity text begins and ends, and the level of confidence that Amazon Comprehend has in the detection.

        
        

        - *(dict) --* 

          Provides information about a PII entity.

          
          

          - **Score** *(float) --* 

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

            
          

          - **Type** *(string) --* 

            The entity's type.

            
          

          - **BeginOffset** *(integer) --* 

            The zero-based offset from the beginning of the source text to the first character in the entity.

            
          

          - **EndOffset** *(integer) --* 

            The zero-based offset from the beginning of the source text to the last character in the entity.

            
      
    
  
  **Exceptions**
  
  *   :py:class:`Comprehend.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`Comprehend.Client.exceptions.TextSizeLimitExceededException`

  
  *   :py:class:`Comprehend.Client.exceptions.UnsupportedLanguageException`

  
  *   :py:class:`Comprehend.Client.exceptions.InternalServerException`

  