< Summary

Class:Azure.AI.TextAnalytics.Models.SentenceSentiment
Assembly:Azure.AI.TextAnalytics
File(s):C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\SentenceSentiment.cs
C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\SentenceSentiment.Serialization.cs
Covered lines:0
Uncovered lines:64
Coverable lines:64
Total lines:154
Line coverage:0% (0 of 64)
Covered branches:0
Total branches:24
Branch coverage:0% (0 of 24)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_Text()-0%100%
get_Sentiment()-0%100%
get_ConfidenceScores()-0%100%
get_Offset()-0%100%
get_Length()-0%100%
get_Aspects()-0%100%
get_Opinions()-0%100%
DeserializeSentenceSentiment(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\SentenceSentiment.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10using Azure.Core;
 11
 12namespace Azure.AI.TextAnalytics.Models
 13{
 14    /// <summary> The SentenceSentiment. </summary>
 15    internal partial class SentenceSentiment
 16    {
 17        /// <summary> Initializes a new instance of SentenceSentiment. </summary>
 18        /// <param name="text"> The sentence text. </param>
 19        /// <param name="sentiment"> The predicted Sentiment for the sentence. </param>
 20        /// <param name="confidenceScores"> The sentiment confidence score between 0 and 1 for the sentence for all clas
 21        /// <param name="offset"> The sentence offset from the start of the document. </param>
 22        /// <param name="length"> The length of the sentence. </param>
 23        /// <exception cref="ArgumentNullException"> <paramref name="text"/> or <paramref name="confidenceScores"/> is n
 024        internal SentenceSentiment(string text, SentenceSentimentValue sentiment, SentimentConfidenceScorePerLabel confi
 25        {
 026            if (text == null)
 27            {
 028                throw new ArgumentNullException(nameof(text));
 29            }
 030            if (confidenceScores == null)
 31            {
 032                throw new ArgumentNullException(nameof(confidenceScores));
 33            }
 34
 035            Text = text;
 036            Sentiment = sentiment;
 037            ConfidenceScores = confidenceScores;
 038            Offset = offset;
 039            Length = length;
 040            Aspects = new ChangeTrackingList<SentenceAspect>();
 041            Opinions = new ChangeTrackingList<SentenceOpinion>();
 042        }
 43
 44        /// <summary> Initializes a new instance of SentenceSentiment. </summary>
 45        /// <param name="text"> The sentence text. </param>
 46        /// <param name="sentiment"> The predicted Sentiment for the sentence. </param>
 47        /// <param name="confidenceScores"> The sentiment confidence score between 0 and 1 for the sentence for all clas
 48        /// <param name="offset"> The sentence offset from the start of the document. </param>
 49        /// <param name="length"> The length of the sentence. </param>
 50        /// <param name="aspects"> The array of aspect object for the sentence. </param>
 51        /// <param name="opinions"> The array of opinion object for the sentence. </param>
 052        internal SentenceSentiment(string text, SentenceSentimentValue sentiment, SentimentConfidenceScorePerLabel confi
 53        {
 054            Text = text;
 055            Sentiment = sentiment;
 056            ConfidenceScores = confidenceScores;
 057            Offset = offset;
 058            Length = length;
 059            Aspects = aspects;
 060            Opinions = opinions;
 061        }
 62
 63        /// <summary> The sentence text. </summary>
 064        public string Text { get; }
 65        /// <summary> The predicted Sentiment for the sentence. </summary>
 066        public SentenceSentimentValue Sentiment { get; }
 67        /// <summary> The sentiment confidence score between 0 and 1 for the sentence for all classes. </summary>
 068        public SentimentConfidenceScorePerLabel ConfidenceScores { get; }
 69        /// <summary> The sentence offset from the start of the document. </summary>
 070        public int Offset { get; }
 71        /// <summary> The length of the sentence. </summary>
 072        public int Length { get; }
 73        /// <summary> The array of aspect object for the sentence. </summary>
 074        public IReadOnlyList<SentenceAspect> Aspects { get; }
 75        /// <summary> The array of opinion object for the sentence. </summary>
 076        public IReadOnlyList<SentenceOpinion> Opinions { get; }
 77    }
 78}

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\SentenceSentiment.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.AI.TextAnalytics.Models
 13{
 14    internal partial class SentenceSentiment
 15    {
 16        internal static SentenceSentiment DeserializeSentenceSentiment(JsonElement element)
 17        {
 018            string text = default;
 019            SentenceSentimentValue sentiment = default;
 020            SentimentConfidenceScorePerLabel confidenceScores = default;
 021            int offset = default;
 022            int length = default;
 023            Optional<IReadOnlyList<SentenceAspect>> aspects = default;
 024            Optional<IReadOnlyList<SentenceOpinion>> opinions = default;
 025            foreach (var property in element.EnumerateObject())
 26            {
 027                if (property.NameEquals("text"))
 28                {
 029                    text = property.Value.GetString();
 030                    continue;
 31                }
 032                if (property.NameEquals("sentiment"))
 33                {
 034                    sentiment = property.Value.GetString().ToSentenceSentimentValue();
 035                    continue;
 36                }
 037                if (property.NameEquals("confidenceScores"))
 38                {
 039                    confidenceScores = SentimentConfidenceScorePerLabel.DeserializeSentimentConfidenceScorePerLabel(prop
 040                    continue;
 41                }
 042                if (property.NameEquals("offset"))
 43                {
 044                    offset = property.Value.GetInt32();
 045                    continue;
 46                }
 047                if (property.NameEquals("length"))
 48                {
 049                    length = property.Value.GetInt32();
 050                    continue;
 51                }
 052                if (property.NameEquals("aspects"))
 53                {
 054                    List<SentenceAspect> array = new List<SentenceAspect>();
 055                    foreach (var item in property.Value.EnumerateArray())
 56                    {
 057                        array.Add(SentenceAspect.DeserializeSentenceAspect(item));
 58                    }
 059                    aspects = array;
 060                    continue;
 61                }
 062                if (property.NameEquals("opinions"))
 63                {
 064                    List<SentenceOpinion> array = new List<SentenceOpinion>();
 065                    foreach (var item in property.Value.EnumerateArray())
 66                    {
 067                        array.Add(SentenceOpinion.DeserializeSentenceOpinion(item));
 68                    }
 069                    opinions = array;
 70                    continue;
 71                }
 72            }
 073            return new SentenceSentiment(text, sentiment, confidenceScores, offset, length, Optional.ToList(aspects), Op
 74        }
 75    }
 76}