medkit.text.ner.edsnlp_tnm_matcher#
Classes#
TNM (Tumour/Node/Metastasis) string matcher based on the EDS-NLP TNM pipeline. |
Module Contents#
- class medkit.text.ner.edsnlp_tnm_matcher.EDSNLPTNMMatcher(output_label: str = 'TNM', attrs_to_copy: list[str] | None = None, uid: str | None = None)#
Bases:
medkit.core.text.operation.NEROperation
TNM (Tumour/Node/Metastasis) string matcher based on the EDS-NLP TNM pipeline.
For each TNM string that is found, an entity will be created with an
TNMAttribute
attribute attached to it containing normalized values of the TNM components.- Parameters:
- output_labelstr, default=”TNM”
Label to use for TNM entities created (the label of the attributes will always be “TNM”)
- attrs_to_copylist of str, optional
Labels of the attributes that should be copied from the input segment to the created TNM entity. Useful for propagating context attributes (negation, antecedent, etc).
- uidstr, optional
Identifier of the matcher
- output_label#
- attrs_to_copy#
- _edsnlp#
- run(segments: list[medkit.core.text.Segment]) list[medkit.core.text.Entity] #
Find and return TNM entities for all segments.
- Parameters:
- segmentslist of Segment
List of segments into which to look for TNM strings
- Returns:
- list of Entity
TNM entities found in segments, with
TNMAttribute
attributes
- _find_tnms_in_segment(segment, spacy_doc) Iterator[medkit.core.text.Entity] #