TextAnalyticsClient.AnalyzeSentiment(String, String, CancellationToken) Method

Definition

Runs a predictive model to identify the positive, negative or neutral sentiment contained in the document, as well as a score indicating the model's confidence in the predicted sentiment. For a list of languages supported by this operation, see . For document length limits, maximum batch size, and supported text encoding, see .

public virtual Azure.Response<Azure.AI.TextAnalytics.DocumentSentiment> AnalyzeSentiment (string document, string language = default, System.Threading.CancellationToken cancellationToken = default);
abstract member AnalyzeSentiment : string * string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.TextAnalytics.DocumentSentiment>
override this.AnalyzeSentiment : string * string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.TextAnalytics.DocumentSentiment>
Public Overridable Function AnalyzeSentiment (document As String, Optional language As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response(Of DocumentSentiment)

Parameters

document
String

The text to analyze.

language
String

The language that the document is written in. If unspecified, this value will be set to the default language in TextAnalyticsClientOptions in the request sent to the service. If set to an empty string, the service will apply a model where the language is explicitly set to "None".

cancellationToken
CancellationToken

A CancellationToken controlling the request lifetime.

Returns

Response<DocumentSentiment>

A result containing sentiment predictions for the document and each of the sentences it contains.

Exceptions

Service returned a non-success status code.

Applies to