示例#1
0
        internal static AnalyzeConversationResult DeserializeAnalyzeConversationResult(JsonElement element)
        {
            string            query            = default;
            Optional <string> detectedLanguage = default;
            BasePrediction    prediction       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("query"))
                {
                    query = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("detectedLanguage"))
                {
                    detectedLanguage = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("prediction"))
                {
                    prediction = BasePrediction.DeserializeBasePrediction(property.Value);
                    continue;
                }
            }
            return(new AnalyzeConversationResult(query, detectedLanguage.Value, prediction));
        }
示例#2
0
        internal AnalyzeConversationResult(string query, BasePrediction prediction)
        {
            if (query == null)
            {
                throw new ArgumentNullException(nameof(query));
            }
            if (prediction == null)
            {
                throw new ArgumentNullException(nameof(prediction));
            }

            Query      = query;
            Prediction = prediction;
        }
示例#3
0
 public static AnalyzeConversationResult AnalyzeConversationResult(string query = null, string detectedLanguage = null, BasePrediction prediction = null)
 {
     return(new AnalyzeConversationResult(query, detectedLanguage, prediction));
 }
示例#4
0
 internal AnalyzeConversationResult(string query, string detectedLanguage, BasePrediction prediction)
 {
     Query            = query;
     DetectedLanguage = detectedLanguage;
     Prediction       = prediction;
 }