internal static DocumentHealthcareEntitiesInternal DeserializeDocumentHealthcareEntitiesInternal(JsonElement element) { string id = default; IReadOnlyList <HealthcareEntityInternal> entities = default; IReadOnlyList <HealthcareRelationInternal> relations = default; IReadOnlyList <TextAnalyticsWarningInternal> warnings = default; Optional <TextDocumentStatistics> statistics = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } 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("warnings")) { List <TextAnalyticsWarningInternal> array = new List <TextAnalyticsWarningInternal>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(TextAnalyticsWarningInternal.DeserializeTextAnalyticsWarningInternal(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 DocumentHealthcareEntitiesInternal(id, entities, relations, warnings, Optional.ToNullable(statistics))); }
internal HealthcareEntity(HealthcareEntityInternal entity) { Category = entity.Category; Text = entity.Text; SubCategory = entity.Subcategory; ConfidenceScore = entity.ConfidenceScore; Offset = entity.Offset; DataSources = entity.Links; RelatedEntities = new Dictionary <HealthcareEntity, HealthcareEntityRelationType>(entity.RelatedEntities); }
internal HealthcareEntity(HealthcareEntityInternal entity) { Category = entity.Category; Text = entity.Text; SubCategory = entity.Subcategory; ConfidenceScore = entity.ConfidenceScore; Offset = entity.Offset; Length = entity.Length; DataSources = entity.Links; Assertion = entity.Assertion; NormalizedText = entity.Name; }
private static IReadOnlyCollection <HealthcareEntityRelationRole> ConvertToHealthcareEntityRelationRoleCollection(IReadOnlyList <HealthcareRelationEntity> entities, IReadOnlyList <HealthcareEntityInternal> healthcareEntities) { List <HealthcareEntityRelationRole> result = new List <HealthcareEntityRelationRole>(); foreach (HealthcareRelationEntity entity in entities) { int refIndex = ParseHealthcareEntityIndex(entity.Ref); HealthcareEntityInternal refEntity = healthcareEntities[refIndex]; result.Add(new HealthcareEntityRelationRole(refEntity, entity.Role)); } return(result); }
internal HealthcareEntityRelationRole(HealthcareEntityInternal entity, string entityName) { Name = entityName; Entity = new HealthcareEntity(entity); }