Condividi tramite


TextAnalyticsClient.AnalyzeSentimentAsync Method

Definition

Runs a predictive model to identify the positive, negative, neutral or mixed 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 https://aka.ms/talangs.

For document length limits, maximum batch size, and supported text encoding, see https://aka.ms/azsdk/textanalytics/data-limits.

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

Parameters

document
String

The document to analyze.

language
String

The language that the document is written in. If unspecified, this value will be set to the default language in DefaultLanguage 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".

options
AnalyzeSentimentOptions

The additional configurable AnalyzeSentimentOptions that may be passed when analyzing sentiments. Options include Opinion mining, model version, and more.

cancellationToken
CancellationToken

A CancellationToken controlling the request lifetime.

Returns

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