internal static DocumentSentiment DeserializeDocumentSentiment(JsonElement element) { string id = default; DocumentSentimentValue sentiment = default; Optional <DocumentStatistics> statistics = default; SentimentConfidenceScorePerLabel confidenceScores = default; IReadOnlyList <SentenceSentiment> sentences = default; IReadOnlyList <TextAnalyticsWarning> warnings = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("sentiment")) { sentiment = property.Value.GetString().ToDocumentSentimentValue(); continue; } if (property.NameEquals("statistics")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value); continue; } if (property.NameEquals("confidenceScores")) { confidenceScores = SentimentConfidenceScorePerLabel.DeserializeSentimentConfidenceScorePerLabel(property.Value); continue; } if (property.NameEquals("sentences")) { List <SentenceSentiment> array = new List <SentenceSentiment>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(SentenceSentiment.DeserializeSentenceSentiment(item)); } sentences = array; continue; } if (property.NameEquals("warnings")) { List <TextAnalyticsWarning> array = new List <TextAnalyticsWarning>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(TextAnalyticsWarning.DeserializeTextAnalyticsWarning(item)); } warnings = array; continue; } } return(new DocumentSentiment(id, sentiment, statistics.Value, confidenceScores, sentences, warnings)); }
internal static DocumentHealthcareEntities DeserializeDocumentHealthcareEntities(JsonElement element) { string id = default; IReadOnlyList <HealthcareEntity> entities = default; IReadOnlyList <HealthcareRelation> relations = default; IReadOnlyList <TextAnalyticsWarning> warnings = default; Optional <DocumentStatistics> statistics = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("entities")) { List <HealthcareEntity> array = new List <HealthcareEntity>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(HealthcareEntity.DeserializeHealthcareEntity(item)); } entities = array; continue; } if (property.NameEquals("relations")) { List <HealthcareRelation> array = new List <HealthcareRelation>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(HealthcareRelation.DeserializeHealthcareRelation(item)); } relations = array; continue; } if (property.NameEquals("warnings")) { List <TextAnalyticsWarning> array = new List <TextAnalyticsWarning>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(TextAnalyticsWarning.DeserializeTextAnalyticsWarning(item)); } warnings = array; continue; } if (property.NameEquals("statistics")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value); continue; } } return(new DocumentHealthcareEntities(id, entities, relations, warnings, statistics.Value)); }
internal static MultiClassificationDocument DeserializeMultiClassificationDocument(JsonElement element) { string id = default; IReadOnlyList <ClassificationResult> classifications = default; IReadOnlyList <TextAnalyticsWarning> warnings = default; Optional <DocumentStatistics> statistics = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("classifications")) { List <ClassificationResult> array = new List <ClassificationResult>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ClassificationResult.DeserializeClassificationResult(item)); } classifications = array; continue; } if (property.NameEquals("warnings")) { List <TextAnalyticsWarning> array = new List <TextAnalyticsWarning>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(TextAnalyticsWarning.DeserializeTextAnalyticsWarning(item)); } warnings = array; continue; } if (property.NameEquals("statistics")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value); continue; } } return(new MultiClassificationDocument(id, classifications, warnings, statistics.Value)); }
internal static ExtractedDocumentSummary DeserializeExtractedDocumentSummary(JsonElement element) { string id = default; IReadOnlyList <ExtractedSummarySentence> sentences = default; IReadOnlyList <TextAnalyticsWarning> warnings = default; Optional <DocumentStatistics> statistics = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("sentences")) { List <ExtractedSummarySentence> array = new List <ExtractedSummarySentence>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ExtractedSummarySentence.DeserializeExtractedSummarySentence(item)); } sentences = array; continue; } if (property.NameEquals("warnings")) { List <TextAnalyticsWarning> array = new List <TextAnalyticsWarning>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(TextAnalyticsWarning.DeserializeTextAnalyticsWarning(item)); } warnings = array; continue; } if (property.NameEquals("statistics")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value); continue; } } return(new ExtractedDocumentSummary(id, sentences, warnings, statistics.Value)); }
internal static DocumentLanguage DeserializeDocumentLanguage(JsonElement element) { string id = default; DetectedLanguage detectedLanguage = default; IReadOnlyList <TextAnalyticsWarning> warnings = default; Optional <DocumentStatistics> statistics = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("detectedLanguage")) { detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value); continue; } if (property.NameEquals("warnings")) { List <TextAnalyticsWarning> array = new List <TextAnalyticsWarning>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(TextAnalyticsWarning.DeserializeTextAnalyticsWarning(item)); } warnings = array; continue; } if (property.NameEquals("statistics")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value); continue; } } return(new DocumentLanguage(id, detectedLanguage, warnings, statistics.Value)); }