Comprehend / Client / detect_dominant_language

detect_dominant_language#

Comprehend.Client.detect_dominant_language(**kwargs)#

Determines the dominant language of the input text. For a list of languages that Amazon Comprehend can detect, see Amazon Comprehend Supported Languages.

See also: AWS API Documentation

Request Syntax

response = client.detect_dominant_language(
    Text='string'
)
Parameters:

Text (string) –

[REQUIRED]

A UTF-8 text string. The string must contain at least 20 characters. The maximum string size is 100 KB.

Return type:

dict

Returns:

Response Syntax

{
    'Languages': [
        {
            'LanguageCode': 'string',
            'Score': ...
        },
    ]
}

Response Structure

  • (dict) –

    • Languages (list) –

      The languages that Amazon Comprehend detected in the input text. For each language, the response returns the RFC 5646 language code and the level of confidence that Amazon Comprehend has in the accuracy of its inference. For more information about RFC 5646, see Tags for Identifying Languages on the IETF Tools web site.

      • (dict) –

        Returns the code for the dominant language in the input text and the level of confidence that Amazon Comprehend has in the accuracy of the detection.

        • LanguageCode (string) –

          The RFC 5646 language code for the dominant language. For more information about RFC 5646, see Tags for Identifying Languages on the IETF Tools web site.

        • 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.InternalServerException