medkit.core.text.entity_norm_attribute
medkit.core.text.entity_norm_attribute#
Classes:
|
Normalization attribute linking an entity to an ID in a knowledge base |
- class EntityNormAttribute(kb_name, kb_id, kb_version=None, term=None, score=None, metadata=None, uid=None)[source]#
Normalization attribute linking an entity to an ID in a knowledge base
- Variables
uid (str) – Identifier of the attribute
label (str) – The attribute label, always set to
EntityNormAttribute.LABEL
value (Optional[Any]) – 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_name (Optional[str]) – 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_id (Optional[Any]) – 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_version (Optional[str]) – Optional version of the knowledge base.
term (Optional[str]) – Optional normalized version of the entity text.
score (Optional[float]) – Optional score reflecting confidence of this link.
metadata (Dict[str, Any]) – Metadata of the attribute
Attributes:
Label used for all normalization attributes
Methods:
copy
()Create a new attribute that is a copy of the current instance, but with a new identifier
from_dict
(data_dict)Creates an Attribute from a dict
get_subclass_for_data_dict
(data_dict)Return the subclass that corresponds to the class name found in a data dict
to_brat
()Return a value compatible with the brat format
to_spacy
()Return a value compatible with spaCy
- LABEL: ClassVar[str] = 'NORMALIZATION'#
Label used for all normalization attributes
- copy()#
Create a new attribute that is a copy of the current instance, but with a new identifier
This is used when we want to duplicate an existing attribute onto a different annotation.
- Return type
- classmethod get_subclass_for_data_dict(data_dict)#
Return the subclass that corresponds to the class name found in a data dict
- Parameters
data_dict (
Dict
[str
,Any
]) – Data dict returned by the to_dict() method of a subclass (or of the base class itself)- Return type
Optional
[Type
[Self
]]- Returns
subclass – Subclass that generated data_dict, or None if data_dict correspond to the base class itself.