Skip to content

batch_detect_dominant_language

batch_detect_dominant_language(
    text_list: CustomerInputStringList,
    *,
    config_overrides: Optional[ComprehendClientConfig] = None,
) -> BatchDetectDominantLanguageResponse

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

Parameters:

  • text_list (CustomerInputStringList) –

    A list containing the UTF-8 encoded text of the input documents. The list can contain a maximum of 25 documents. Each document should contain at least 20 characters. The maximum size of each document is 5 KB.

Raises:

Source code in docs_src/capo_comprehend/_services/comprehend.py
def batch_detect_dominant_language(
    self,
    text_list: "capo_comprehend.types.customer_input_string_list.CustomerInputStringList",
    *,
    config_overrides: Optional[ComprehendClientConfig] = None,
) -> "capo_comprehend.types.batch_detect_dominant_language_response.BatchDetectDominantLanguageResponse":
    """<p>Determines the dominant language of the input text for a batch of documents. For a list of languages that Amazon Comprehend can detect, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-languages.html">Amazon Comprehend Supported Languages</a>. </p>

    Args:
        text_list: <p>A list containing the UTF-8 encoded text of the input documents. The list can contain a maximum of 25 documents. Each document should contain at least 20 characters. The maximum size of each document is 5 KB.</p>

    Raises:
        capo_comprehend.errors.batch_size_limit_exceeded_exception.BatchSizeLimitExceededException: <p>The number of documents in the request exceeds the limit of 25. Try your request again with fewer documents.</p>
        capo_comprehend.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_comprehend.errors.invalid_request_exception.InvalidRequestException: <p>The request is invalid.</p>
        capo_comprehend.errors.text_size_limit_exceeded_exception.TextSizeLimitExceededException: <p>The size of the input text exceeds the limit. Use a smaller document.</p>
        capo_comprehend.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_comprehend.types.batch_detect_dominant_language_request.BatchDetectDominantLanguageRequest]",
    ) -> OperationResponse[
        "capo_comprehend.types.batch_detect_dominant_language_response.BatchDetectDominantLanguageResponse"
    ]:
        import capo_comprehend._operations.comprehend_20171127.batch_detect_dominant_language

        output, http_response = (
            capo_comprehend._operations.comprehend_20171127.batch_detect_dominant_language.batch_detect_dominant_language(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_comprehend.types.batch_detect_dominant_language_request.BatchDetectDominantLanguageRequest",
    ) -> dict[str, Any]:
        import capo_comprehend.types.batch_detect_dominant_language_request

        return capo_comprehend.types.batch_detect_dominant_language_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("BatchDetectDominantLanguage", redact_input=_redact_input),
    )
    input_: capo_comprehend.types.batch_detect_dominant_language_request.BatchDetectDominantLanguageRequest = {
        "text_list": text_list
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output