medkit.core.text.entity_norm_attribute#
Classes#
Normalization attribute linking an entity to an ID in a knowledge base. |
Module Contents#
- class medkit.core.text.entity_norm_attribute.EntityNormAttribute(kb_name: str | None, kb_id: Any | None, kb_version: str | None = None, term: str | None = None, score: float | None = None, metadata: dict[str, Any] | None = None, uid: str | None = None)#
Bases:
medkit.core.attribute.Attribute
Normalization attribute linking an entity to an ID in a knowledge base.
- Attributes:
- uidstr
Identifier of the attribute
- labelstr
The attribute label, always set to
EntityNormAttribute.LABEL
- valueAny
String representation of the normalization, containing kb_id, along with kb_name if available (ex: βumls:C0011849β). For special cases where only term is available, it is used as value.
- kb_namestr, optional
Name of the knowledge base (ex: βicdβ). Should always be provided except in special cases when we just want to store a normalized term.
- kb_idAny, optional
ID in the knowledge base to which the annotation should be linked. Should always be provided except in special cases when we just want to store a normalized term.
- kb_versionstr, optional
Optional version of the knowledge base.
- termstr, optional
Optional normalized version of the entity text.
- scorefloat, optional
Optional score reflecting confidence of this link.
- metadatadict of str to Any
Metadata of the attribute
- kb_name: str | None#
- kb_id: Any | None#
- kb_version: str | None#
- term: str | None#
- score: float | None#
- LABEL: ClassVar[str] = 'NORMALIZATION'#
Label used for all normalization attributes
- to_brat() str #
Return a value compatible with the brat format.
- to_spacy() str #
Return a value compatible with spaCy.
- to_dict() dict[str, Any] #
- classmethod from_dict(data_dict: dict[str, Any]) typing_extensions.Self #
Create an Attribute from a dict.
- Parameters:
- attribute_dict: dict of str to Any
A dictionary from a serialized Attribute as generated by to_dict()