detectKeyPhrases method
Future<DetectKeyPhrasesResponse>
detectKeyPhrases({
- required LanguageCode languageCode,
- required String text,
Detects the key noun phrases found in the text.
May throw InvalidRequestException. May throw TextSizeLimitExceededException. May throw UnsupportedLanguageException. May throw InternalServerException.
Parameter languageCode
:
The language of the input documents. You can specify any of the primary
languages supported by Amazon Comprehend. All documents must be in the
same language.
Parameter text
:
A UTF-8 text string. Each string must contain fewer that 5,000 bytes of
UTF-8 encoded characters.
Implementation
Future<DetectKeyPhrasesResponse> detectKeyPhrases({
required LanguageCode languageCode,
required String text,
}) async {
ArgumentError.checkNotNull(languageCode, 'languageCode');
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.DetectKeyPhrases'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'LanguageCode': languageCode.toValue(),
'Text': text,
},
);
return DetectKeyPhrasesResponse.fromJson(jsonResponse.body);
}