Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Azure.AI.TextAnalytics
/// </summary>
public class DocumentSentiment
{
internal DocumentSentiment(SentimentLabel sentiment, double positiveScore, double neutralScore, double negativeScore, List<SentenceSentiment> sentenceSentiments)
internal DocumentSentiment(DocumentSentimentLabel sentiment, double positiveScore, double neutralScore, double negativeScore, List<SentenceSentiment> sentenceSentiments)
{
Sentiment = sentiment;
ConfidenceScores = new SentimentConfidenceScorePerLabel(positiveScore, neutralScore, negativeScore);
Expand All @@ -27,7 +27,7 @@ internal DocumentSentiment(SentimentLabel sentiment, double positiveScore, doubl
/// Gets the predicted sentiment for the analyzed input document
/// or substring.
/// </summary>
public SentimentLabel Sentiment { get; }
public DocumentSentimentLabel Sentiment { get; }

/// <summary>
/// Gets the sentiment confidence score (Softmax score) between 0 and 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
namespace Azure.AI.TextAnalytics
{
/// <summary>
/// The predicted sentiment label for a given span of text.
/// The predicted sentiment label for a given document.
/// </summary>
public enum SentimentLabel
#pragma warning restore
public enum DocumentSentimentLabel
{
/// <summary>
/// Indicates that the sentiment is positive.
/// </summary>
Positive,

/// <summary>
/// Indicates that the lacks a sentiment.
/// Indicates that the sentiment is neutral.
/// </summary>
Neutral,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics
/// </summary>
public readonly struct SentenceSentiment
{
internal SentenceSentiment(SentimentLabel sentiment, double positiveScore, double neutralScore, double negativeScore, int offset, int length)
internal SentenceSentiment(SentenceSentimentLabel sentiment, double positiveScore, double neutralScore, double negativeScore, int offset, int length)
{
Sentiment = sentiment;
ConfidenceScores = new SentimentConfidenceScorePerLabel(positiveScore, neutralScore, negativeScore);
Expand All @@ -22,7 +22,7 @@ internal SentenceSentiment(SentimentLabel sentiment, double positiveScore, doubl
/// Gets the predicted sentiment for the analyzed input document
/// or substring.
/// </summary>
public SentimentLabel Sentiment { get; }
public SentenceSentimentLabel Sentiment { get; }

/// <summary>
/// Gets the sentiment confidence score (Softmax score) between 0 and 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Azure.AI.TextAnalytics
{
/// <summary>
/// The predicted sentiment label for a given sentence.
/// </summary>
public enum SentenceSentimentLabel
{
/// <summary>
/// Indicates that the sentiment is positive.
/// </summary>
Positive,

/// <summary>
/// Indicates that the sentiment is neutral.
/// </summary>
Neutral,

/// <summary>
/// Indicates that the sentiment is negative.
/// </summary>
Negative,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -404,14 +404,14 @@ private static AnalyzeSentimentResult ReadDocumentSentimentResult(JsonElement do

private static DocumentSentiment ReadDocumentSentiment(JsonElement documentElement, string scoresElementName)
{
SentimentLabel sentiment = default;
DocumentSentimentLabel sentiment = default;
double positiveScore = default;
double neutralScore = default;
double negativeScore = default;

if (documentElement.TryGetProperty("sentiment", out JsonElement sentimentValue))
{
sentiment = (SentimentLabel)Enum.Parse(typeof(SentimentLabel), sentimentValue.ToString(), ignoreCase: true);
sentiment = (DocumentSentimentLabel)Enum.Parse(typeof(DocumentSentimentLabel), sentimentValue.ToString(), ignoreCase: true);
Comment thread
jsquire marked this conversation as resolved.
}

if (documentElement.TryGetProperty(scoresElementName, out JsonElement scoreValues))
Expand Down Expand Up @@ -440,7 +440,7 @@ private static DocumentSentiment ReadDocumentSentiment(JsonElement documentEleme

private static SentenceSentiment ReadSentenceSentiment(JsonElement documentElement, string scoresElementName)
{
SentimentLabel sentiment = default;
SentenceSentimentLabel sentiment = default;
double positiveScore = default;
double neutralScore = default;
double negativeScore = default;
Expand All @@ -449,7 +449,7 @@ private static SentenceSentiment ReadSentenceSentiment(JsonElement documentEleme

if (documentElement.TryGetProperty("sentiment", out JsonElement sentimentValue))
{
sentiment = (SentimentLabel)Enum.Parse(typeof(SentimentLabel), sentimentValue.ToString(), ignoreCase: true);
sentiment = (SentenceSentimentLabel)Enum.Parse(typeof(SentenceSentimentLabel), sentimentValue.ToString(), ignoreCase: true);
Comment thread
maririos marked this conversation as resolved.
}

if (documentElement.TryGetProperty(scoresElementName, out JsonElement scoreValues))
Expand Down