medkit.core.attribute
medkit.core.attribute#
Classes:
|
Medkit attribute, to be added to an annotation |
- class Attribute(label, value=None, metadata=None, uid=None)[source]#
Medkit attribute, to be added to an annotation
- Variables
label (str) – The attribute label
value (Optional[Any]) – The value of the attribute. Should be either simple built-in types (int, float, bool, str) or collections of these types (list, dict, tuple). If you need structured complex data you should create a subclass of Attribute.
metadata (Dict[str, Any]) – The metadata of the attribute
uid (str) – The identifier of the attribute
Methods:
copy
()Create a new attribute that is a copy of the current instance, but with a new identifier
from_dict
(attribute_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
- 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.