Exemplo n.º 1
0
        internal static Model_internal DeserializeModel_internal(JsonElement element)
        {
            Model_internal result = new Model_internal();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("modelInfo"))
                {
                    result.ModelInfo = ModelInfo_internal.DeserializeModelInfo_internal(property.Value);
                    continue;
                }
                if (property.NameEquals("keys"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.Keys = KeysResult_internal.DeserializeKeysResult_internal(property.Value);
                    continue;
                }
                if (property.NameEquals("trainResult"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.TrainResult = TrainResult_internal.DeserializeTrainResult_internal(property.Value);
                    continue;
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        internal static Model_internal DeserializeModel_internal(JsonElement element)
        {
            ModelInfo_internal   modelInfo   = default;
            KeysResult_internal  keys        = default;
            TrainResult_internal trainResult = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("modelInfo"))
                {
                    modelInfo = ModelInfo_internal.DeserializeModelInfo_internal(property.Value);
                    continue;
                }
                if (property.NameEquals("keys"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    keys = KeysResult_internal.DeserializeKeysResult_internal(property.Value);
                    continue;
                }
                if (property.NameEquals("trainResult"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    trainResult = TrainResult_internal.DeserializeTrainResult_internal(property.Value);
                    continue;
                }
            }
            return(new Model_internal(modelInfo, keys, trainResult));
        }
        internal static TrainResult_internal DeserializeTrainResult_internal(JsonElement element)
        {
            TrainResult_internal result = new TrainResult_internal();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("trainingDocuments"))
                {
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        result.TrainingDocuments.Add(TrainingDocumentInfo.DeserializeTrainingDocumentInfo(item));
                    }
                    continue;
                }
                if (property.NameEquals("fields"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.Fields = new List <FieldPredictionAccuracy>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        result.Fields.Add(FieldPredictionAccuracy.DeserializeFieldPredictionAccuracy(item));
                    }
                    continue;
                }
                if (property.NameEquals("averageModelAccuracy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.AverageModelAccuracy = property.Value.GetSingle();
                    continue;
                }
                if (property.NameEquals("errors"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.Errors = new List <FormRecognizerError>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        result.Errors.Add(FormRecognizerError.DeserializeFormRecognizerError(item));
                    }
                    continue;
                }
            }
            return(result);
        }
Exemplo n.º 4
0
 internal Model_internal(ModelInfo_internal modelInfo, KeysResult_internal keys, TrainResult_internal trainResult)
 {
     ModelInfo   = modelInfo;
     Keys        = keys;
     TrainResult = trainResult;
 }