| | 1 | | // <auto-generated> |
| | 2 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 3 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 4 | | // license information. |
| | 5 | | // |
| | 6 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 7 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 8 | | // regenerated. |
| | 9 | | // </auto-generated> |
| | 10 | |
|
| | 11 | | namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models |
| | 12 | | { |
| | 13 | | using Microsoft.Rest; |
| | 14 | | using Newtonsoft.Json; |
| | 15 | | using System.Collections; |
| | 16 | | using System.Collections.Generic; |
| | 17 | | using System.Linq; |
| | 18 | |
|
| | 19 | | /// <summary> |
| | 20 | | /// Defines the entity type and position of the extracted entity within the |
| | 21 | | /// example. |
| | 22 | | /// </summary> |
| | 23 | | public partial class EntityLabelObject |
| | 24 | | { |
| | 25 | | /// <summary> |
| | 26 | | /// Initializes a new instance of the EntityLabelObject class. |
| | 27 | | /// </summary> |
| 8 | 28 | | public EntityLabelObject() |
| | 29 | | { |
| | 30 | | CustomInit(); |
| 8 | 31 | | } |
| | 32 | |
|
| | 33 | | /// <summary> |
| | 34 | | /// Initializes a new instance of the EntityLabelObject class. |
| | 35 | | /// </summary> |
| | 36 | | /// <param name="entityName">The entity type.</param> |
| | 37 | | /// <param name="startCharIndex">The index within the utterance where |
| | 38 | | /// the extracted entity starts.</param> |
| | 39 | | /// <param name="endCharIndex">The index within the utterance where the |
| | 40 | | /// extracted entity ends.</param> |
| | 41 | | /// <param name="role">The role the entity plays in the |
| | 42 | | /// utterance.</param> |
| | 43 | | /// <param name="children">The identified entities within the example |
| | 44 | | /// utterance.</param> |
| 0 | 45 | | public EntityLabelObject(string entityName, int startCharIndex, int endCharIndex, string role = default(string), |
| | 46 | | { |
| 0 | 47 | | EntityName = entityName; |
| 0 | 48 | | StartCharIndex = startCharIndex; |
| 0 | 49 | | EndCharIndex = endCharIndex; |
| 0 | 50 | | Role = role; |
| 0 | 51 | | Children = children; |
| | 52 | | CustomInit(); |
| 0 | 53 | | } |
| | 54 | |
|
| | 55 | | /// <summary> |
| | 56 | | /// An initialization method that performs custom operations like setting defaults |
| | 57 | | /// </summary> |
| | 58 | | partial void CustomInit(); |
| | 59 | |
|
| | 60 | | /// <summary> |
| | 61 | | /// Gets or sets the entity type. |
| | 62 | | /// </summary> |
| | 63 | | [JsonProperty(PropertyName = "entityName")] |
| 16 | 64 | | public string EntityName { get; set; } |
| | 65 | |
|
| | 66 | | /// <summary> |
| | 67 | | /// Gets or sets the index within the utterance where the extracted |
| | 68 | | /// entity starts. |
| | 69 | | /// </summary> |
| | 70 | | [JsonProperty(PropertyName = "startCharIndex")] |
| 16 | 71 | | public int StartCharIndex { get; set; } |
| | 72 | |
|
| | 73 | | /// <summary> |
| | 74 | | /// Gets or sets the index within the utterance where the extracted |
| | 75 | | /// entity ends. |
| | 76 | | /// </summary> |
| | 77 | | [JsonProperty(PropertyName = "endCharIndex")] |
| 16 | 78 | | public int EndCharIndex { get; set; } |
| | 79 | |
|
| | 80 | | /// <summary> |
| | 81 | | /// Gets or sets the role the entity plays in the utterance. |
| | 82 | | /// </summary> |
| | 83 | | [JsonProperty(PropertyName = "role")] |
| 0 | 84 | | public string Role { get; set; } |
| | 85 | |
|
| | 86 | | /// <summary> |
| | 87 | | /// Gets or sets the identified entities within the example utterance. |
| | 88 | | /// </summary> |
| | 89 | | [JsonProperty(PropertyName = "children")] |
| 10 | 90 | | public IList<EntityLabelObject> Children { get; set; } |
| | 91 | |
|
| | 92 | | /// <summary> |
| | 93 | | /// Validate the object. |
| | 94 | | /// </summary> |
| | 95 | | /// <exception cref="ValidationException"> |
| | 96 | | /// Thrown if validation fails |
| | 97 | | /// </exception> |
| | 98 | | public virtual void Validate() |
| | 99 | | { |
| 0 | 100 | | if (EntityName == null) |
| | 101 | | { |
| 0 | 102 | | throw new ValidationException(ValidationRules.CannotBeNull, "EntityName"); |
| | 103 | | } |
| 0 | 104 | | if (Children != null) |
| | 105 | | { |
| 0 | 106 | | foreach (var element in Children) |
| | 107 | | { |
| 0 | 108 | | if (element != null) |
| | 109 | | { |
| 0 | 110 | | element.Validate(); |
| | 111 | | } |
| | 112 | | } |
| | 113 | | } |
| 0 | 114 | | } |
| | 115 | | } |
| | 116 | | } |