medkit.core.text.umls_norm_attribute#

Classes:

UMLSNormAttribute(cui, umls_version[, term, ...])

Normalization attribute linking an entity to a CUI in the UMLS knowledge base

class UMLSNormAttribute(cui, umls_version, term=None, score=None, sem_types=None, metadata=None, uid=None)[source]#

Normalization attribute linking an entity to a CUI in the UMLS knowledge base

Variables
  • uid – Identifier of the attribute

  • label – The attribute label, always set to EntityNormAttribute.LABEL

  • value – CUI prefixed with “umls:” (ex: “umls:C0011849”)

  • kb_name – Name of the knowledge base. Always “umls”

  • kb_id – CUI (Concept Unique Identifier) to which the annotation should be linked

  • cui – Convenience alias of kb_id

  • kb_version – Version of the UMLS database (ex: “202AB”)

  • umls_version – Convenience alias of kb_version

  • term – Optional normalized version of the entity text

  • score – Optional score reflecting confidence of this link

  • sem_types (Optional[List[str]]) – Optional IDs of semantic types of the CUI (ex: [“T047”])

  • metadata – Metadata of the attribute

Methods:

copy()

Create a new attribute that is a copy of the current instance, but with a new identifier

from_dict(data)

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

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

Attribute

classmethod from_dict(data)[source]#

Creates an Attribute from a dict

Parameters

attribute_dict (dict) – A dictionary from a serialized Attribute as generated by to_dict()

Return type

Self

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.

to_brat()#

Return a value compatible with the brat format

Return type

str

to_spacy()#

Return a value compatible with spaCy

Return type

str