medkit.core.text.entity_attribute_container#

Classes:

EntityAttributeContainer(owner_id)

Manage a list of attributes attached to a text entity.

class EntityAttributeContainer(owner_id)[source]#

Manage a list of attributes attached to a text entity.

This behaves more or less like a list: calling len() and iterating are supported. Additional filtering is available through the get() method.

Also provides retrieval of normalization attributes.

Attributes:

norms

Return the list of normalization attributes

Methods:

add(attr)

Attach an attribute to the annotation.

get(*[, label])

Return a list of the attributes of the annotation, optionally filtering by label.

get_by_id(uid)

Return the attribute corresponding to a specific identifier.

get_norms()

Return a list of the normalization attributes of the annotation

property norms: List[medkit.core.text.entity_norm_attribute.EntityNormAttribute]#

Return the list of normalization attributes

Return type

List[EntityNormAttribute]

add(attr)[source]#

Attach an attribute to the annotation.

Parameters

attr (Attribute) – Attribute to add.

Raises

ValueError – If the attribute is already attached to the annotation (based on attr.uid).

get_norms()[source]#

Return a list of the normalization attributes of the annotation

Return type

List[EntityNormAttribute]

get(*, label=None)#

Return a list of the attributes of the annotation, optionally filtering by label.

Parameters

label (Optional[str]) – Label to use to filter attributes.

Return type

List[Attribute]

get_by_id(uid)#

Return the attribute corresponding to a specific identifier.

Parameters

uid (str) – Identifier of the attribute to return.

Return type

Attribute