< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_Text()-0%100%
get_Category()-0%100%
get_Subcategory()-0%100%
get_Offset()-0%100%
get_Length()-0%100%
get_ConfidenceScore()-0%100%
DeserializeEntity(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\Entity.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;
 9
 10namespace Azure.AI.TextAnalytics.Models
 11{
 12    /// <summary> The Entity. </summary>
 13    internal partial class Entity
 14    {
 15        /// <summary> Initializes a new instance of Entity. </summary>
 16        /// <param name="text"> Entity text as appears in the request. </param>
 17        /// <param name="category"> Entity type, such as Person/Location/Org/SSN etc. </param>
 18        /// <param name="offset"> Start position for the entity text. </param>
 19        /// <param name="length"> Length for the entity text. </param>
 20        /// <param name="confidenceScore"> Confidence score between 0 and 1 of the extracted entity. </param>
 21        /// <exception cref="ArgumentNullException"> <paramref name="text"/> or <paramref name="category"/> is null. </e
 022        internal Entity(string text, string category, int offset, int length, double confidenceScore)
 23        {
 024            if (text == null)
 25            {
 026                throw new ArgumentNullException(nameof(text));
 27            }
 028            if (category == null)
 29            {
 030                throw new ArgumentNullException(nameof(category));
 31            }
 32
 033            Text = text;
 034            Category = category;
 035            Offset = offset;
 036            Length = length;
 037            ConfidenceScore = confidenceScore;
 038        }
 39
 40        /// <summary> Initializes a new instance of Entity. </summary>
 41        /// <param name="text"> Entity text as appears in the request. </param>
 42        /// <param name="category"> Entity type, such as Person/Location/Org/SSN etc. </param>
 43        /// <param name="subcategory"> Entity sub type, such as Age/Year/TimeRange etc. </param>
 44        /// <param name="offset"> Start position for the entity text. </param>
 45        /// <param name="length"> Length for the entity text. </param>
 46        /// <param name="confidenceScore"> Confidence score between 0 and 1 of the extracted entity. </param>
 047        internal Entity(string text, string category, string subcategory, int offset, int length, double confidenceScore
 48        {
 049            Text = text;
 050            Category = category;
 051            Subcategory = subcategory;
 052            Offset = offset;
 053            Length = length;
 054            ConfidenceScore = confidenceScore;
 055        }
 56
 57        /// <summary> Entity text as appears in the request. </summary>
 058        public string Text { get; }
 59        /// <summary> Entity type, such as Person/Location/Org/SSN etc. </summary>
 060        public string Category { get; }
 61        /// <summary> Entity sub type, such as Age/Year/TimeRange etc. </summary>
 062        public string Subcategory { get; }
 63        /// <summary> Start position for the entity text. </summary>
 064        public int Offset { get; }
 65        /// <summary> Length for the entity text. </summary>
 066        public int Length { get; }
 67        /// <summary> Confidence score between 0 and 1 of the extracted entity. </summary>
 068        public double ConfidenceScore { get; }
 69    }
 70}

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\Entity.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.AI.TextAnalytics.Models
 12{
 13    internal partial class Entity
 14    {
 15        internal static Entity DeserializeEntity(JsonElement element)
 16        {
 017            string text = default;
 018            string category = default;
 019            Optional<string> subcategory = default;
 020            int offset = default;
 021            int length = default;
 022            double confidenceScore = default;
 023            foreach (var property in element.EnumerateObject())
 24            {
 025                if (property.NameEquals("text"))
 26                {
 027                    text = property.Value.GetString();
 028                    continue;
 29                }
 030                if (property.NameEquals("category"))
 31                {
 032                    category = property.Value.GetString();
 033                    continue;
 34                }
 035                if (property.NameEquals("subcategory"))
 36                {
 037                    subcategory = property.Value.GetString();
 038                    continue;
 39                }
 040                if (property.NameEquals("offset"))
 41                {
 042                    offset = property.Value.GetInt32();
 043                    continue;
 44                }
 045                if (property.NameEquals("length"))
 46                {
 047                    length = property.Value.GetInt32();
 048                    continue;
 49                }
 050                if (property.NameEquals("confidenceScore"))
 51                {
 052                    confidenceScore = property.Value.GetDouble();
 53                    continue;
 54                }
 55            }
 056            return new Entity(text, category, subcategory.Value, offset, length, confidenceScore);
 57        }
 58    }
 59}