< Summary

Class:Azure.Search.Documents.Indexes.Models.KeyPhraseExtractionSkill
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\KeyPhraseExtractionSkill.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\KeyPhraseExtractionSkill.Serialization.cs
Covered lines:76
Uncovered lines:12
Coverable lines:88
Total lines:196
Line coverage:86.3% (76 of 88)
Covered branches:37
Total branches:46
Branch coverage:80.4% (37 of 46)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-71.43%50%
.ctor(...)-100%50%
get_DefaultLanguageCode()-100%100%
get_MaxKeyPhraseCount()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-75%68.75%
DeserializeKeyPhraseExtractionSkill(...)-95.24%95.83%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\KeyPhraseExtractionSkill.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;
 10
 11namespace Azure.Search.Documents.Indexes.Models
 12{
 13    /// <summary> A skill that uses text analytics for key phrase extraction. </summary>
 14    public partial class KeyPhraseExtractionSkill : SearchIndexerSkill
 15    {
 16        /// <summary> Initializes a new instance of KeyPhraseExtractionSkill. </summary>
 17        /// <param name="inputs"> Inputs of the skills could be a column in the source data set, or the output of an ups
 18        /// <param name="outputs"> The output of a skill is either a field in a search index, or a value that can be con
 19        /// <exception cref="ArgumentNullException"> <paramref name="inputs"/> or <paramref name="outputs"/> is null. </
 220        public KeyPhraseExtractionSkill(IEnumerable<InputFieldMappingEntry> inputs, IEnumerable<OutputFieldMappingEntry>
 21        {
 222            if (inputs == null)
 23            {
 024                throw new ArgumentNullException(nameof(inputs));
 25            }
 226            if (outputs == null)
 27            {
 028                throw new ArgumentNullException(nameof(outputs));
 29            }
 30
 231            ODataType = "#Microsoft.Skills.Text.KeyPhraseExtractionSkill";
 232        }
 33
 34        /// <summary> Initializes a new instance of KeyPhraseExtractionSkill. </summary>
 35        /// <param name="oDataType"> Identifies the concrete type of the skill. </param>
 36        /// <param name="name"> The name of the skill which uniquely identifies it within the skillset. A skill with no 
 37        /// <param name="description"> The description of the skill which describes the inputs, outputs, and usage of th
 38        /// <param name="context"> Represents the level at which operations take place, such as the document root or doc
 39        /// <param name="inputs"> Inputs of the skills could be a column in the source data set, or the output of an ups
 40        /// <param name="outputs"> The output of a skill is either a field in a search index, or a value that can be con
 41        /// <param name="defaultLanguageCode"> A value indicating which language code to use. Default is en. </param>
 42        /// <param name="maxKeyPhraseCount"> A number indicating how many key phrases to return. If absent, all identifi
 643        internal KeyPhraseExtractionSkill(string oDataType, string name, string description, string context, IList<Input
 44        {
 645            DefaultLanguageCode = defaultLanguageCode;
 646            MaxKeyPhraseCount = maxKeyPhraseCount;
 647            ODataType = oDataType ?? "#Microsoft.Skills.Text.KeyPhraseExtractionSkill";
 648        }
 49
 50        /// <summary> A value indicating which language code to use. Default is en. </summary>
 1651        public KeyPhraseExtractionSkillLanguage? DefaultLanguageCode { get; set; }
 52        /// <summary> A number indicating how many key phrases to return. If absent, all identified key phrases will be 
 1053        public int? MaxKeyPhraseCount { get; set; }
 54    }
 55}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\KeyPhraseExtractionSkill.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.Search.Documents.Indexes.Models
 13{
 14    public partial class KeyPhraseExtractionSkill : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 418            writer.WriteStartObject();
 419            if (Optional.IsDefined(DefaultLanguageCode))
 20            {
 421                writer.WritePropertyName("defaultLanguageCode");
 422                writer.WriteStringValue(DefaultLanguageCode.Value.ToString());
 23            }
 424            if (Optional.IsDefined(MaxKeyPhraseCount))
 25            {
 026                if (MaxKeyPhraseCount != null)
 27                {
 028                    writer.WritePropertyName("maxKeyPhraseCount");
 029                    writer.WriteNumberValue(MaxKeyPhraseCount.Value);
 30                }
 31                else
 32                {
 033                    writer.WriteNull("maxKeyPhraseCount");
 34                }
 35            }
 436            writer.WritePropertyName("@odata.type");
 437            writer.WriteStringValue(ODataType);
 438            if (Optional.IsDefined(Name))
 39            {
 040                writer.WritePropertyName("name");
 041                writer.WriteStringValue(Name);
 42            }
 443            if (Optional.IsDefined(Description))
 44            {
 045                writer.WritePropertyName("description");
 046                writer.WriteStringValue(Description);
 47            }
 448            if (Optional.IsDefined(Context))
 49            {
 450                writer.WritePropertyName("context");
 451                writer.WriteStringValue(Context);
 52            }
 453            writer.WritePropertyName("inputs");
 454            writer.WriteStartArray();
 2455            foreach (var item in Inputs)
 56            {
 857                writer.WriteObjectValue(item);
 58            }
 459            writer.WriteEndArray();
 460            writer.WritePropertyName("outputs");
 461            writer.WriteStartArray();
 1662            foreach (var item in Outputs)
 63            {
 464                writer.WriteObjectValue(item);
 65            }
 466            writer.WriteEndArray();
 467            writer.WriteEndObject();
 468        }
 69
 70        internal static KeyPhraseExtractionSkill DeserializeKeyPhraseExtractionSkill(JsonElement element)
 71        {
 672            Optional<KeyPhraseExtractionSkillLanguage> defaultLanguageCode = default;
 673            Optional<int?> maxKeyPhraseCount = default;
 674            string odataType = default;
 675            Optional<string> name = default;
 676            Optional<string> description = default;
 677            Optional<string> context = default;
 678            IList<InputFieldMappingEntry> inputs = default;
 679            IList<OutputFieldMappingEntry> outputs = default;
 10880            foreach (var property in element.EnumerateObject())
 81            {
 4882                if (property.NameEquals("defaultLanguageCode"))
 83                {
 684                    defaultLanguageCode = new KeyPhraseExtractionSkillLanguage(property.Value.GetString());
 685                    continue;
 86                }
 4287                if (property.NameEquals("maxKeyPhraseCount"))
 88                {
 689                    if (property.Value.ValueKind == JsonValueKind.Null)
 90                    {
 691                        maxKeyPhraseCount = null;
 692                        continue;
 93                    }
 094                    maxKeyPhraseCount = property.Value.GetInt32();
 095                    continue;
 96                }
 3697                if (property.NameEquals("@odata.type"))
 98                {
 699                    odataType = property.Value.GetString();
 6100                    continue;
 101                }
 30102                if (property.NameEquals("name"))
 103                {
 6104                    name = property.Value.GetString();
 6105                    continue;
 106                }
 24107                if (property.NameEquals("description"))
 108                {
 6109                    description = property.Value.GetString();
 6110                    continue;
 111                }
 18112                if (property.NameEquals("context"))
 113                {
 6114                    context = property.Value.GetString();
 6115                    continue;
 116                }
 12117                if (property.NameEquals("inputs"))
 118                {
 6119                    List<InputFieldMappingEntry> array = new List<InputFieldMappingEntry>();
 36120                    foreach (var item in property.Value.EnumerateArray())
 121                    {
 12122                        array.Add(InputFieldMappingEntry.DeserializeInputFieldMappingEntry(item));
 123                    }
 6124                    inputs = array;
 6125                    continue;
 126                }
 6127                if (property.NameEquals("outputs"))
 128                {
 6129                    List<OutputFieldMappingEntry> array = new List<OutputFieldMappingEntry>();
 24130                    foreach (var item in property.Value.EnumerateArray())
 131                    {
 6132                        array.Add(OutputFieldMappingEntry.DeserializeOutputFieldMappingEntry(item));
 133                    }
 6134                    outputs = array;
 135                    continue;
 136                }
 137            }
 6138            return new KeyPhraseExtractionSkill(odataType, name.Value, description.Value, context.Value, inputs, outputs
 139        }
 140    }
 141}