internal DocumentSentiment(TextSentiment sentiment, double positiveScore, double neutralScore, double negativeScore, List <SentenceSentiment> sentenceSentiments, IList <TextAnalyticsWarning> warnings)
 {
     Sentiment        = sentiment;
     ConfidenceScores = new SentimentConfidenceScores(positiveScore, neutralScore, negativeScore);
     Sentences        = new ReadOnlyCollection <SentenceSentiment>(sentenceSentiments);
     Warnings         = new ReadOnlyCollection <TextAnalyticsWarning>(warnings);
 }
 internal SentenceSentiment(TextSentiment sentiment, string text, double positiveScore, double neutralScore, double negativeScore, IReadOnlyList <MinedOpinion> minedOpinions)
 {
     Sentiment        = sentiment;
     Text             = text;
     ConfidenceScores = new SentimentConfidenceScores(positiveScore, neutralScore, negativeScore);
     MinedOpinions    = new List <MinedOpinion>(minedOpinions);
 }
 internal AspectSentiment(TextSentiment sentiment, string text, double positiveScore, double negativeScore, int offset)
 {
     Sentiment        = sentiment;
     Text             = text;
     ConfidenceScores = new SentimentConfidenceScores(positiveScore, _neutralValue, negativeScore);
     Offset           = offset;
 }
 internal OpinionSentiment(TextSentiment sentiment, double positiveScore, double negativeScore, string text, bool isNegated)
 {
     Sentiment        = sentiment;
     ConfidenceScores = new SentimentConfidenceScores(positiveScore, _neutralValue, negativeScore);
     Text             = text;
     IsNegated        = isNegated;
 }
Пример #5
0
 internal TargetSentiment(TextSentiment sentiment, string text, double positiveScore, double negativeScore, int offset, int length)
 {
     Sentiment        = sentiment;
     Text             = text;
     ConfidenceScores = new SentimentConfidenceScores(positiveScore, _neutralValue, negativeScore);
     Offset           = offset;
     Length           = length;
 }
Пример #6
0
 internal AssessmentSentiment(TextSentiment sentiment, double positiveScore, double negativeScore, string text, bool isNegated, int offset, int length)
 {
     Sentiment        = sentiment;
     ConfidenceScores = new SentimentConfidenceScores(positiveScore, _neutralValue, negativeScore);
     Text             = text;
     IsNegated        = isNegated;
     Offset           = offset;
     Length           = length;
 }
Пример #7
0
 internal SentenceSentiment(TextSentiment sentiment, string text, double positiveScore, double neutralScore, double negativeScore, int offset, int length, IReadOnlyList <SentenceOpinion> opinions)
 {
     Sentiment        = sentiment;
     Text             = text;
     ConfidenceScores = new SentimentConfidenceScores(positiveScore, neutralScore, negativeScore);
     Offset           = offset;
     Length           = length;
     Opinions         = new List <SentenceOpinion>(opinions);
 }
Пример #8
0
        internal SentenceSentiment(TextSentiment sentiment, string text, double positiveScore, double neutralScore, double negativeScore, int offset, int length, IReadOnlyList <SentenceOpinion> opinions)
        {
            // We shipped TA 5.0.0 Text == string.Empty if the service returned a null value for Text.
            // Because we don't want to introduce a breaking change, we are transforming that null to string.Empty
            Text = text ?? string.Empty;

            Sentiment        = sentiment;
            ConfidenceScores = new SentimentConfidenceScores(positiveScore, neutralScore, negativeScore);
            Offset           = offset;
            Length           = length;
            Opinions         = new List <SentenceOpinion>(opinions);
        }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of <see cref="TextAnalytics.OpinionSentiment"/> for mocking purposes.
 /// </summary>
 /// <param name="sentiment">Sets the <see cref="OpinionSentiment.Sentiment"/> property.</param>
 /// <param name="positiveScore">Sets the <see cref="SentimentConfidenceScores.Positive"/> property.</param>
 /// <param name="negativeScore">Sets the <see cref="SentimentConfidenceScores.Negative"/> property.</param>
 /// <param name="text">Sets the <see cref="OpinionSentiment.Text"/> property.</param>
 /// <param name="isNegated">Sets the <see cref="OpinionSentiment.IsNegated"/> property.</param>
 /// <returns>A new instance of <see cref="TextAnalytics.OpinionSentiment"/> for mocking purposes.</returns>
 public static OpinionSentiment OpinionSentiment(TextSentiment sentiment, double positiveScore, double negativeScore, string text, bool isNegated)
 {
     return(new OpinionSentiment(sentiment, positiveScore, negativeScore, text, isNegated));
 }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of <see cref="TextAnalytics.AspectSentiment"/> for mocking purposes.
 /// </summary>
 /// <param name="sentiment">Sets the <see cref="AspectSentiment.Sentiment"/> property.</param>
 /// <param name="text">Sets the <see cref="AspectSentiment.Text"/> property.</param>
 /// <param name="positiveScore">Sets the <see cref="SentimentConfidenceScores.Positive"/> property.</param>
 /// <param name="negativeScore">Sets the <see cref="SentimentConfidenceScores.Negative"/> property.</param>
 /// <returns>>A new instance of <see cref="TextAnalytics.AspectSentiment"/> for mocking purposes.</returns>
 public static AspectSentiment AspectSentiment(TextSentiment sentiment, string text, double positiveScore, double negativeScore)
 {
     return(new AspectSentiment(sentiment, text, positiveScore, negativeScore));
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of <see cref="TextAnalytics.SentenceSentiment"/> for mocking purposes.
 /// </summary>
 /// <param name="sentiment">Sets the <see cref="SentenceSentiment.Sentiment"/> property.</param>
 /// <param name="text">Sets the <see cref="SentenceSentiment.Text"/> property.</param>
 /// <param name="positiveScore">Sets the <see cref="SentimentConfidenceScores.Positive"/> property.</param>
 /// <param name="neutralScore">Sets the <see cref="SentimentConfidenceScores.Neutral"/> property.</param>
 /// <param name="negativeScore">Sets the <see cref="SentimentConfidenceScores.Negative"/> property.</param>
 /// <param name="minedOpinions">Sets the <see cref="SentenceSentiment.MinedOpinions"/> property.</param>
 /// <returns>A new instance of <see cref="TextAnalytics.SentenceSentiment"/> for mocking purposes.</returns>
 public static SentenceSentiment SentenceSentiment(TextSentiment sentiment, string text, double positiveScore, double neutralScore, double negativeScore, IReadOnlyList <MinedOpinion> minedOpinions)
 {
     minedOpinions ??= new List <MinedOpinion>();
     return(new SentenceSentiment(sentiment, text, positiveScore, neutralScore, negativeScore, minedOpinions));
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of <see cref="TextAnalytics.SentenceSentiment"/> for mocking purposes.
 /// </summary>
 /// <param name="sentiment">Sets the <see cref="SentenceSentiment.Sentiment"/> property.</param>
 /// <param name="text">Sets the <see cref="SentenceSentiment.Text"/> property.</param>
 /// <param name="positiveScore">Sets the <see cref="SentimentConfidenceScores.Positive"/> property.</param>
 /// <param name="neutralScore">Sets the <see cref="SentimentConfidenceScores.Neutral"/> property.</param>
 /// <param name="negativeScore">Sets the <see cref="SentimentConfidenceScores.Negative"/> property.</param>
 /// <returns>A new instance of <see cref="TextAnalytics.SentenceSentiment"/> for mocking purposes.</returns>
 public static SentenceSentiment SentenceSentiment(TextSentiment sentiment, string text, double positiveScore, double neutralScore, double negativeScore)
 {
     return(new SentenceSentiment(sentiment, text, positiveScore, neutralScore, negativeScore));
 }
Пример #13
0
 public static string ToSerialString(this TextSentiment value) => value switch
 {
Пример #14
0
 public static SentenceSentiment SentenceSentiment(TextSentiment sentiment, string text, double positiveScore, double neutralScore, double negativeScore)
 {
     return(new SentenceSentiment(sentiment, text, positiveScore, neutralScore, negativeScore, default, default, new List <MinedOpinion>()));
Пример #15
0
 /// <summary>
 /// Initializes a new instance of <see cref="TextAnalytics.SentenceSentiment"/> for mocking purposes.
 /// </summary>
 /// <param name="sentiment">Sets the <see cref="SentenceSentiment.Sentiment"/> property.</param>
 /// <param name="positiveScore">Sets the <see cref="SentimentConfidenceScores.Positive"/> property.</param>
 /// <param name="neutralScore">Sets the <see cref="SentimentConfidenceScores.Neutral"/> property.</param>
 /// <param name="negativeScore">Sets the <see cref="SentimentConfidenceScores.Negative"/> property.</param>
 /// <param name="offset">Sets the <see cref="SentenceSentiment.GraphemeOffset"/> property.</param>
 /// <param name="length">Sets the <see cref="SentenceSentiment.GraphemeLength"/> property.</param>
 /// <returns>A new instance of <see cref="TextAnalytics.SentenceSentiment"/> for mocking purposes.</returns>
 public static SentenceSentiment SentenceSentiment(TextSentiment sentiment, double positiveScore, double neutralScore, double negativeScore, int offset, int length)
 {
     return(new SentenceSentiment(sentiment, positiveScore, neutralScore, negativeScore, offset, length));
 }
 internal SentenceSentiment(TextSentiment sentiment, string text, double positiveScore, double neutralScore, double negativeScore)
 {
     Sentiment        = sentiment;
     Text             = text;
     ConfidenceScores = new SentimentConfidenceScores(positiveScore, neutralScore, negativeScore);
 }
 internal AnalyzeSentimentResult(string id, TextDocumentStatistics statistics, TextSentiment documentSentiment, IList <TextSentiment> sentenceSentiments)
     : base(id, statistics)
 {
     DocumentSentiment  = documentSentiment;
     SentenceSentiments = new ReadOnlyCollection <TextSentiment>(sentenceSentiments);
 }
 internal DocumentSentiment(TextSentiment sentiment, double positiveScore, double neutralScore, double negativeScore, List <SentenceSentiment> sentenceSentiments)
 {
     Sentiment        = sentiment;
     ConfidenceScores = new SentimentConfidenceScore(positiveScore, neutralScore, negativeScore);
     Sentences        = new ReadOnlyCollection <SentenceSentiment>(sentenceSentiments);
 }
Пример #19
0
 /// <summary>
 /// Initializes a new instance of <see cref="TextAnalytics.DocumentSentiment"/> for mocking purposes.
 /// </summary>
 /// <param name="sentiment">Sets the <see cref="DocumentSentiment.Sentiment"/> property.</param>
 /// <param name="positiveScore">Sets the <see cref="SentimentConfidenceScores.Positive"/> property.</param>
 /// <param name="neutralScore">Sets the <see cref="SentimentConfidenceScores.Neutral"/> property.</param>
 /// <param name="negativeScore">Sets the <see cref="SentimentConfidenceScores.Negative"/> property.</param>
 /// <param name="sentenceSentiments">Sets the <see cref="DocumentSentiment.Sentences"/> property.</param>
 /// <param name="warnings">Sets the <see cref="DetectedLanguage.Warnings"/> property.</param>
 /// <returns>A new instance of <see cref="TextAnalytics.DocumentSentiment"/> for mocking purposes.</returns>
 public static DocumentSentiment DocumentSentiment(TextSentiment sentiment, double positiveScore, double neutralScore, double negativeScore, List <SentenceSentiment> sentenceSentiments, IList <TextAnalyticsWarning> warnings = default)
 {
     warnings ??= new List <TextAnalyticsWarning>();
     return(new DocumentSentiment(sentiment, positiveScore, neutralScore, negativeScore, sentenceSentiments, warnings));
 }
Пример #20
0
 /// <summary>
 /// Initializes a new instance of <see cref="TextAnalytics.DocumentSentiment"/> for mocking purposes.
 /// </summary>
 /// <param name="sentiment">Sets the <see cref="DocumentSentiment.Sentiment"/> property.</param>
 /// <param name="positiveScore">Sets the <see cref="SentimentConfidenceScores.Positive"/> property.</param>
 /// <param name="neutralScore">Sets the <see cref="SentimentConfidenceScores.Neutral"/> property.</param>
 /// <param name="negativeScore">Sets the <see cref="SentimentConfidenceScores.Negative"/> property.</param>
 /// <param name="sentenceSentiments">Sets the <see cref="DocumentSentiment.Sentences"/> property.</param>
 /// <returns>A new instance of <see cref="TextAnalytics.DocumentSentiment"/> for mocking purposes.</returns>
 public static DocumentSentiment DocumentSentiment(TextSentiment sentiment, double positiveScore, double neutralScore, double negativeScore, List <SentenceSentiment> sentenceSentiments)
 {
     return(new DocumentSentiment(sentiment, positiveScore, neutralScore, negativeScore, sentenceSentiments));
 }