コード例 #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;
 }