batchDetectTargetedSentiment method

Future<BatchDetectTargetedSentimentResponse> batchDetectTargetedSentiment({
  1. required LanguageCode languageCode,
  2. required List<String> textList,
})

Inspects a batch of documents and returns a sentiment analysis for each entity identified in the documents.

For more information about targeted sentiment, see Targeted sentiment in the Amazon Comprehend Developer Guide.

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

Parameter languageCode : The language of the input documents. Currently, English is the only supported language.

Parameter textList : A list containing the UTF-8 encoded text of the input documents. The list can contain a maximum of 25 documents. The maximum size of each document is 5 KB.

Implementation

Future<BatchDetectTargetedSentimentResponse> batchDetectTargetedSentiment({
  required LanguageCode languageCode,
  required List<String> textList,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Comprehend_20171127.BatchDetectTargetedSentiment'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'LanguageCode': languageCode.value,
      'TextList': textList,
    },
  );

  return BatchDetectTargetedSentimentResponse.fromJson(jsonResponse.body);
}