Share via


SentenceSentiment Class

  • java.lang.Object
    • com.azure.ai.textanalytics.models.SentenceSentiment

public final class SentenceSentiment

The SentenceSentiment model that contains a sentiment label of a sentence, confidence scores of the sentiment label, sentence opinions, and offset of sentence within a document.

Constructor Summary

Constructor Description
SentenceSentiment(String text, TextSentiment sentiment, SentimentConfidenceScores confidenceScores)

Creates a SentenceSentiment model that describes the sentiment analysis of sentence.

Method Summary

Modifier and Type Method and Description
SentimentConfidenceScores getConfidenceScores()

Gets the confidence score of the sentiment label.

int getLength()

Gets the length of sentence.

int getOffset()

Gets the offset of sentence.

IterableStream<SentenceOpinion> getOpinions()

Gets the sentence opinions of sentence sentiment.

TextSentiment getSentiment()

Gets the text sentiment label: POSITIVE, NEGATIVE, or NEUTRAL.

String getText()

Gets the sentence text property.

Methods inherited from java.lang.Object

Constructor Details

SentenceSentiment

public SentenceSentiment(String text, TextSentiment sentiment, SentimentConfidenceScores confidenceScores)

Creates a SentenceSentiment model that describes the sentiment analysis of sentence.

Parameters:

text - The sentence text.
sentiment - The sentiment label of the sentence.
confidenceScores - The sentiment confidence score (Softmax score) between 0 and 1, for each sentiment label. Higher values signify higher confidence.

Method Details

getConfidenceScores

public SentimentConfidenceScores getConfidenceScores()

Gets the confidence score of the sentiment label. All score values sum up to 1, the higher the score, the higher the confidence in the sentiment.

Returns:

getLength

public int getLength()

Gets the length of sentence.

Returns:

The length of sentence.

getOffset

public int getOffset()

Gets the offset of sentence. The start position for the sentence in a document.

Returns:

The offset of sentence.

getOpinions

public IterableStream<SentenceOpinion> getOpinions()

Gets the sentence opinions of sentence sentiment. This is only returned if you pass the opinion mining parameter to the analyze sentiment APIs.

Returns:

The sentence opinions of sentence sentiment.

getSentiment

public TextSentiment getSentiment()

Gets the text sentiment label: POSITIVE, NEGATIVE, or NEUTRAL.

Returns:

getText

public String getText()

Gets the sentence text property.

Returns:

The text property value.

Applies to