detectDominantLanguage method
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 InternalServerException.
May throw InvalidRequestException.
May throw TextSizeLimitExceededException.
Parameter text :
A UTF-8 text string. The string must contain at least 20 characters. The
maximum string size is 100 KB.
Implementation
Future<DetectDominantLanguageResponse> detectDominantLanguage({
required String text,
}) async {
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);
}