| | 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.Runtime.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 | | /// Represents the prediction of a query. |
| | 21 | | /// </summary> |
| | 22 | | public partial class Prediction |
| | 23 | | { |
| | 24 | | /// <summary> |
| | 25 | | /// Initializes a new instance of the Prediction class. |
| | 26 | | /// </summary> |
| 8 | 27 | | public Prediction() |
| | 28 | | { |
| | 29 | | CustomInit(); |
| 8 | 30 | | } |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Initializes a new instance of the Prediction class. |
| | 34 | | /// </summary> |
| | 35 | | /// <param name="topIntent">The name of the top scoring intent.</param> |
| | 36 | | /// <param name="intents">A dictionary representing the intents that |
| | 37 | | /// fired.</param> |
| | 38 | | /// <param name="entities">A dictionary representing the entities that |
| | 39 | | /// fired.</param> |
| | 40 | | /// <param name="alteredQuery">The query after spell checking. Only set |
| | 41 | | /// if spell check was enabled and a spelling mistake was |
| | 42 | | /// found.</param> |
| | 43 | | /// <param name="sentiment">The result of the sentiment |
| | 44 | | /// analysis.</param> |
| 0 | 45 | | public Prediction(string topIntent, IDictionary<string, Intent> intents, IDictionary<string, object> entities, s |
| | 46 | | { |
| 0 | 47 | | AlteredQuery = alteredQuery; |
| 0 | 48 | | TopIntent = topIntent; |
| 0 | 49 | | Intents = intents; |
| 0 | 50 | | Entities = entities; |
| 0 | 51 | | Sentiment = sentiment; |
| | 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 query after spell checking. Only set if spell |
| | 62 | | /// check was enabled and a spelling mistake was found. |
| | 63 | | /// </summary> |
| | 64 | | [JsonProperty(PropertyName = "alteredQuery")] |
| 0 | 65 | | public string AlteredQuery { get; set; } |
| | 66 | |
|
| | 67 | | /// <summary> |
| | 68 | | /// Gets or sets the name of the top scoring intent. |
| | 69 | | /// </summary> |
| | 70 | | [JsonProperty(PropertyName = "topIntent")] |
| 24 | 71 | | public string TopIntent { get; set; } |
| | 72 | |
|
| | 73 | | /// <summary> |
| | 74 | | /// Gets or sets a dictionary representing the intents that fired. |
| | 75 | | /// </summary> |
| | 76 | | [JsonProperty(PropertyName = "intents")] |
| 32 | 77 | | public IDictionary<string, Intent> Intents { get; set; } |
| | 78 | |
|
| | 79 | | /// <summary> |
| | 80 | | /// Gets or sets a dictionary representing the entities that fired. |
| | 81 | | /// </summary> |
| | 82 | | [JsonProperty(PropertyName = "entities")] |
| 52 | 83 | | public IDictionary<string, object> Entities { get; set; } |
| | 84 | |
|
| | 85 | | /// <summary> |
| | 86 | | /// Gets or sets the result of the sentiment analysis. |
| | 87 | | /// </summary> |
| | 88 | | [JsonProperty(PropertyName = "sentiment")] |
| 32 | 89 | | public Sentiment Sentiment { get; set; } |
| | 90 | |
|
| | 91 | | /// <summary> |
| | 92 | | /// Validate the object. |
| | 93 | | /// </summary> |
| | 94 | | /// <exception cref="ValidationException"> |
| | 95 | | /// Thrown if validation fails |
| | 96 | | /// </exception> |
| | 97 | | public virtual void Validate() |
| | 98 | | { |
| 0 | 99 | | if (TopIntent == null) |
| | 100 | | { |
| 0 | 101 | | throw new ValidationException(ValidationRules.CannotBeNull, "TopIntent"); |
| | 102 | | } |
| 0 | 103 | | if (Intents == null) |
| | 104 | | { |
| 0 | 105 | | throw new ValidationException(ValidationRules.CannotBeNull, "Intents"); |
| | 106 | | } |
| 0 | 107 | | if (Entities == null) |
| | 108 | | { |
| 0 | 109 | | throw new ValidationException(ValidationRules.CannotBeNull, "Entities"); |
| | 110 | | } |
| 0 | 111 | | if (Intents != null) |
| | 112 | | { |
| 0 | 113 | | foreach (var valueElement in Intents.Values) |
| | 114 | | { |
| 0 | 115 | | if (valueElement != null) |
| | 116 | | { |
| 0 | 117 | | valueElement.Validate(); |
| | 118 | | } |
| | 119 | | } |
| | 120 | | } |
| 0 | 121 | | if (Sentiment != null) |
| | 122 | | { |
| 0 | 123 | | Sentiment.Validate(); |
| | 124 | | } |
| 0 | 125 | | } |
| | 126 | | } |
| | 127 | | } |