detectSyntax method
Future<DetectSyntaxResponse>
detectSyntax({
- required SyntaxLanguageCode languageCode,
- required String text,
Inspects text for syntax and the part of speech of words in the document. For more information, see Syntax in the Comprehend Developer Guide.
May throw InternalServerException.
May throw InvalidRequestException.
May throw TextSizeLimitExceededException.
May throw UnsupportedLanguageException.
Parameter languageCode :
The language code of the input documents. You can specify any of the
following languages supported by Amazon Comprehend: German ("de"), English
("en"), Spanish ("es"), French ("fr"), Italian ("it"), or Portuguese
("pt").
Parameter text :
A UTF-8 string. The maximum string size is 5 KB.
Implementation
Future<DetectSyntaxResponse> detectSyntax({
required SyntaxLanguageCode languageCode,
required String text,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Comprehend_20171127.DetectSyntax'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'LanguageCode': languageCode.value,
'Text': text,
},
);
return DetectSyntaxResponse.fromJson(jsonResponse.body);
}