medkit.text.spacy.edsnlp#

Attributes#

DEFAULT_ATTRIBUTE_FACTORIES

Pre-defined attribute factories to handle EDS-NLP attributes

Classes#

EDSNLPPipeline

Segment annotator relying on an EDS-NLP pipeline.

EDSNLPDocPipeline

DocPipeline to obtain annotations created using EDS-NLP.

Functions#

build_date_attribute(→ medkit.core.Attribute)

Build a medkit date attribute from an EDS-NLP attribute with a date object as value.

build_duration_attribute(...)

Build a medkit duration attribute from an EDS-NLP attribute with a duration object as value.

build_adicap_attribute(...)

Build a medkit ADICAP normalization attribute from an EDS-NLP attribute with an ADICAP object as value.

build_tnm_attribute(...)

Build a medkit TNM attribute from an EDS-NLP attribute with a TNM object as value.

build_measurement_attribute(→ medkit.core.Attribute)

Build a medkit attribute from an EDS-NLP attribute with a measurement object as value.

Module Contents#

medkit.text.spacy.edsnlp.build_date_attribute(spacy_span: spacy.tokens.Span, spacy_label: str) medkit.core.Attribute#

Build a medkit date attribute from an EDS-NLP attribute with a date object as value.

Parameters:
spacy_spanSpacySpan

Spacy span having an ESD-NLP date attribute

spacy_labelstr

Label of the date attribute on spacy_spacy. Ex: “date”, “consultation_date”

Returns:
Attribute

DateAttribute or RelativeDateAttribute instance, depending on the EDS-NLP attribute

medkit.text.spacy.edsnlp.build_duration_attribute(spacy_span: spacy.tokens.Span, spacy_label: str) medkit.text.ner.DurationAttribute#

Build a medkit duration attribute from an EDS-NLP attribute with a duration object as value.

Parameters:
spacy_spanSpacySpan

Spacy span having an ESD-NLP date attribute

spacy_labelstr

Label of the date attribute on spacy_spacy. Ex: “duration”

Returns:
DurationAttribute

Medkit duration attribute

medkit.text.spacy.edsnlp.build_adicap_attribute(spacy_span: spacy.tokens.Span, spacy_label: str) medkit.text.ner.ADICAPNormAttribute#

Build a medkit ADICAP normalization attribute from an EDS-NLP attribute with an ADICAP object as value.

Parameters:
spacy_spanSpacySpan

Spacy span having an ADICAP object as value

spacy_labelstr

Label of the attribute on spacy_spacy. Ex: “adicap”

Returns:
ADICAPNormAttribute

Medkit ADICAP normalization attribute

medkit.text.spacy.edsnlp.build_tnm_attribute(spacy_span: spacy.tokens.Span, spacy_label: str) medkit.text.ner.tnm_attribute.TNMAttribute#

Build a medkit TNM attribute from an EDS-NLP attribute with a TNM object as value.

Parameters:
spacy_spanSpacySpan

Spacy span having a TNM object as value

spacy_labelstr

Label of the attribute on spacy_spacy. Ex: “tnm”

Returns:
TNMAttribute

Medkit TNM attribute

medkit.text.spacy.edsnlp.build_measurement_attribute(spacy_span: spacy.tokens.Span, spacy_label: str) medkit.core.Attribute#

Build a medkit attribute from an EDS-NLP attribute with a measurement object as value.

Parameters:
spacy_spanSpacySpan

Spacy span having a measurement object as value

spacy_labelstr

Label of the attribute on spacy_spacy. Ex: “size”, “weight”, “bmi”

Returns:
Attribute

Medkit attribute with normalized measurement value and “unit” metadata

medkit.text.spacy.edsnlp.DEFAULT_ATTRIBUTE_FACTORIES#

Pre-defined attribute factories to handle EDS-NLP attributes

class medkit.text.spacy.edsnlp.EDSNLPPipeline(nlp: spacy.Language, spacy_entities: list[str] | None = None, spacy_span_groups: list[str] | None = None, spacy_attrs: list[str] | None = None, medkit_attribute_factories: dict[str, Callable[[spacy.tokens.Span, str], medkit.core.Attribute]] | None = None, name: str | None = None, uid: str | None = None)#

Bases: medkit.text.spacy.SpacyPipeline

Segment annotator relying on an EDS-NLP pipeline.

class medkit.text.spacy.edsnlp.EDSNLPDocPipeline(nlp: spacy.Language, medkit_labels_anns: list[str] | None = None, medkit_attrs: list[str] | None = None, spacy_entities: list[str] | None = None, spacy_span_groups: list[str] | None = None, spacy_attrs: list[str] | None = None, medkit_attribute_factories: dict[str, Callable[[spacy.tokens.Span, str], medkit.core.Attribute]] | None = None, name: str | None = None, uid: str | None = None)#

Bases: medkit.text.spacy.SpacyDocPipeline

DocPipeline to obtain annotations created using EDS-NLP.