internal static SentimentResponseDocumentsItem DeserializeSentimentResponseDocumentsItem(JsonElement element) { TextSentiment sentiment = default; SentimentConfidenceScores confidenceScores = default; IList <SentenceSentimentInternal> sentences = default; string id = default; IList <DocumentWarning> warnings = default; Optional <TextDocumentStatistics> statistics = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sentiment")) { sentiment = property.Value.GetString().ToTextSentiment(); continue; } if (property.NameEquals("confidenceScores")) { confidenceScores = SentimentConfidenceScores.DeserializeSentimentConfidenceScores(property.Value); continue; } if (property.NameEquals("sentences")) { List <SentenceSentimentInternal> array = new List <SentenceSentimentInternal>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(SentenceSentimentInternal.DeserializeSentenceSentimentInternal(item)); } sentences = array; continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("warnings")) { List <DocumentWarning> array = new List <DocumentWarning>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DocumentWarning.DeserializeDocumentWarning(item)); } warnings = array; continue; } if (property.NameEquals("statistics")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } } return(new SentimentResponseDocumentsItem(id, warnings, Optional.ToNullable(statistics), sentiment, confidenceScores, sentences)); }
internal static PiiEntitiesDocumentResult DeserializePiiEntitiesDocumentResult(JsonElement element) { string redactedText = default; IList <Entity> entities = default; string id = default; IList <DocumentWarning> warnings = default; Optional <TextDocumentStatistics> statistics = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("redactedText")) { redactedText = property.Value.GetString(); continue; } if (property.NameEquals("entities")) { List <Entity> array = new List <Entity>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(Entity.DeserializeEntity(item)); } entities = array; continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("warnings")) { List <DocumentWarning> array = new List <DocumentWarning>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DocumentWarning.DeserializeDocumentWarning(item)); } warnings = array; continue; } if (property.NameEquals("statistics")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } } return(new PiiEntitiesDocumentResult(id, warnings, Optional.ToNullable(statistics), redactedText, entities)); }
internal static ExtractedSummaryDocumentResult DeserializeExtractedSummaryDocumentResult(JsonElement element) { IList <ExtractedSummarySentence> sentences = default; string id = default; IList <DocumentWarning> warnings = default; Optional <TextDocumentStatistics> statistics = default; foreach (var property in element.EnumerateObject()) { 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("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("warnings")) { List <DocumentWarning> array = new List <DocumentWarning>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DocumentWarning.DeserializeDocumentWarning(item)); } warnings = array; continue; } if (property.NameEquals("statistics")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } } return(new ExtractedSummaryDocumentResult(id, warnings, Optional.ToNullable(statistics), sentences)); }
internal static KeyPhraseResultDocumentsItem DeserializeKeyPhraseResultDocumentsItem(JsonElement element) { IList <string> keyPhrases = default; string id = default; IList <DocumentWarning> warnings = default; Optional <TextDocumentStatistics> statistics = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyPhrases")) { List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } keyPhrases = array; continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("warnings")) { List <DocumentWarning> array = new List <DocumentWarning>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DocumentWarning.DeserializeDocumentWarning(item)); } warnings = array; continue; } if (property.NameEquals("statistics")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } } return(new KeyPhraseResultDocumentsItem(id, warnings, Optional.ToNullable(statistics), keyPhrases)); }
internal static MultiClassificationDocumentResult DeserializeMultiClassificationDocumentResult(JsonElement element) { IList <ClassificationResult> @class = default; string id = default; IList <DocumentWarning> warnings = default; Optional <TextDocumentStatistics> statistics = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("class")) { List <ClassificationResult> array = new List <ClassificationResult>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ClassificationResult.DeserializeClassificationResult(item)); } @class = array; continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("warnings")) { List <DocumentWarning> array = new List <DocumentWarning>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DocumentWarning.DeserializeDocumentWarning(item)); } warnings = array; continue; } if (property.NameEquals("statistics")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } } return(new MultiClassificationDocumentResult(id, warnings, Optional.ToNullable(statistics), @class)); }
internal static LanguageDetectionDocumentResult DeserializeLanguageDetectionDocumentResult(JsonElement element) { DetectedLanguageInternal detectedLanguage = default; string id = default; IList <DocumentWarning> warnings = default; Optional <TextDocumentStatistics> statistics = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("detectedLanguage")) { detectedLanguage = DetectedLanguageInternal.DeserializeDetectedLanguageInternal(property.Value); continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("warnings")) { List <DocumentWarning> array = new List <DocumentWarning>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DocumentWarning.DeserializeDocumentWarning(item)); } warnings = array; continue; } if (property.NameEquals("statistics")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } } return(new LanguageDetectionDocumentResult(id, warnings, Optional.ToNullable(statistics), detectedLanguage)); }
internal static HealthcareEntitiesDocumentResult DeserializeHealthcareEntitiesDocumentResult(JsonElement element) { IList <HealthcareEntityInternal> entities = default; IList <HealthcareRelationInternal> relations = default; Optional <IDictionary <string, object> > fhirBundle = default; string id = default; IList <DocumentWarning> warnings = default; Optional <TextDocumentStatistics> statistics = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("entities")) { List <HealthcareEntityInternal> array = new List <HealthcareEntityInternal>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(HealthcareEntityInternal.DeserializeHealthcareEntityInternal(item)); } entities = array; continue; } if (property.NameEquals("relations")) { List <HealthcareRelationInternal> array = new List <HealthcareRelationInternal>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(HealthcareRelationInternal.DeserializeHealthcareRelationInternal(item)); } relations = array; continue; } if (property.NameEquals("fhirBundle")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, object> dictionary = new Dictionary <string, object>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetObject()); } fhirBundle = dictionary; continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("warnings")) { List <DocumentWarning> array = new List <DocumentWarning>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DocumentWarning.DeserializeDocumentWarning(item)); } warnings = array; continue; } if (property.NameEquals("statistics")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } } return(new HealthcareEntitiesDocumentResult(id, warnings, Optional.ToNullable(statistics), entities, relations, Optional.ToDictionary(fhirBundle))); }