| | 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 | | /// A suggested entity. |
| | 21 | | /// </summary> |
| | 22 | | public partial class EntityPrediction |
| | 23 | | { |
| | 24 | | /// <summary> |
| | 25 | | /// Initializes a new instance of the EntityPrediction class. |
| | 26 | | /// </summary> |
| 0 | 27 | | public EntityPrediction() |
| | 28 | | { |
| | 29 | | CustomInit(); |
| 0 | 30 | | } |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Initializes a new instance of the EntityPrediction class. |
| | 34 | | /// </summary> |
| | 35 | | /// <param name="entityName">The entity's name</param> |
| | 36 | | /// <param name="startTokenIndex">The index within the utterance where |
| | 37 | | /// the extracted entity starts.</param> |
| | 38 | | /// <param name="endTokenIndex">The index within the utterance where |
| | 39 | | /// the extracted entity ends.</param> |
| | 40 | | /// <param name="phrase">The actual token(s) that comprise the |
| | 41 | | /// entity.</param> |
| 0 | 42 | | public EntityPrediction(string entityName, int startTokenIndex, int endTokenIndex, string phrase, IList<EntityPr |
| | 43 | | { |
| 0 | 44 | | EntityName = entityName; |
| 0 | 45 | | StartTokenIndex = startTokenIndex; |
| 0 | 46 | | EndTokenIndex = endTokenIndex; |
| 0 | 47 | | Phrase = phrase; |
| 0 | 48 | | Children = children; |
| | 49 | | CustomInit(); |
| 0 | 50 | | } |
| | 51 | |
|
| | 52 | | /// <summary> |
| | 53 | | /// An initialization method that performs custom operations like setting defaults |
| | 54 | | /// </summary> |
| | 55 | | partial void CustomInit(); |
| | 56 | |
|
| | 57 | | /// <summary> |
| | 58 | | /// Gets or sets the entity's name |
| | 59 | | /// </summary> |
| | 60 | | [JsonProperty(PropertyName = "entityName")] |
| 0 | 61 | | public string EntityName { get; set; } |
| | 62 | |
|
| | 63 | | /// <summary> |
| | 64 | | /// Gets or sets the index within the utterance where the extracted |
| | 65 | | /// entity starts. |
| | 66 | | /// </summary> |
| | 67 | | [JsonProperty(PropertyName = "startTokenIndex")] |
| 0 | 68 | | public int StartTokenIndex { get; set; } |
| | 69 | |
|
| | 70 | | /// <summary> |
| | 71 | | /// Gets or sets the index within the utterance where the extracted |
| | 72 | | /// entity ends. |
| | 73 | | /// </summary> |
| | 74 | | [JsonProperty(PropertyName = "endTokenIndex")] |
| 0 | 75 | | public int EndTokenIndex { get; set; } |
| | 76 | |
|
| | 77 | | /// <summary> |
| | 78 | | /// Gets or sets the actual token(s) that comprise the entity. |
| | 79 | | /// </summary> |
| | 80 | | [JsonProperty(PropertyName = "phrase")] |
| 0 | 81 | | public string Phrase { get; set; } |
| | 82 | |
|
| | 83 | | /// <summary> |
| | 84 | | /// </summary> |
| | 85 | | [JsonProperty(PropertyName = "children")] |
| 0 | 86 | | public IList<EntityPrediction> Children { get; set; } |
| | 87 | |
|
| | 88 | | /// <summary> |
| | 89 | | /// Validate the object. |
| | 90 | | /// </summary> |
| | 91 | | /// <exception cref="ValidationException"> |
| | 92 | | /// Thrown if validation fails |
| | 93 | | /// </exception> |
| | 94 | | public virtual void Validate() |
| | 95 | | { |
| 0 | 96 | | if (EntityName == null) |
| | 97 | | { |
| 0 | 98 | | throw new ValidationException(ValidationRules.CannotBeNull, "EntityName"); |
| | 99 | | } |
| 0 | 100 | | if (Phrase == null) |
| | 101 | | { |
| 0 | 102 | | throw new ValidationException(ValidationRules.CannotBeNull, "Phrase"); |
| | 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 | | } |