detectDominantLanguage method

Future<DetectDominantLanguageResponse> detectDominantLanguage({
  1. required String text,
})

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

May throw InvalidRequestException. May throw TextSizeLimitExceededException. May throw InternalServerException.

Parameter text : A UTF-8 text string. Each string should contain at least 20 characters and must contain fewer that 5,000 bytes of UTF-8 encoded characters.

Implementation

Future<DetectDominantLanguageResponse> detectDominantLanguage({
  required String text,
}) async {
  ArgumentError.checkNotNull(text, 'text');
  _s.validateStringLength(
    'text',
    text,
    1,
    1152921504606846976,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Comprehend_20171127.DetectDominantLanguage'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Text': text,
    },
  );

  return DetectDominantLanguageResponse.fromJson(jsonResponse.body);
}