detectKeyPhrases method

Future<DetectKeyPhrasesResponse> detectKeyPhrases({
  1. required LanguageCode languageCode,
  2. required String text,
})

Detects the key noun phrases found in the text.

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

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. The string must contain less than 100 KB of UTF-8 encoded characters.

Implementation

Future<DetectKeyPhrasesResponse> detectKeyPhrases({
  required LanguageCode languageCode,
  required String text,
}) async {
  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.value,
      'Text': text,
    },
  );

  return DetectKeyPhrasesResponse.fromJson(jsonResponse.body);
}