medkit.text.spacy.edsnlp#
Attributes#
Pre-defined attribute factories to handle EDS-NLP attributes |
Classes#
Segment annotator relying on an EDS-NLP pipeline. |
|
DocPipeline to obtain annotations created using EDS-NLP. |
Functions#
|
Build a medkit date attribute from an EDS-NLP attribute with a date object as value. |
Build a medkit duration attribute from an EDS-NLP attribute with a duration object as value. |
|
Build a medkit ADICAP normalization attribute from an EDS-NLP attribute with an ADICAP object as value. |
|
|
Build a medkit TNM attribute from an EDS-NLP attribute with a TNM object as value. |
|
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
orRelativeDateAttribute
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.