medkit.core.audio.annotation_container#

Classes#

AudioAnnotationContainer

Manage a list of audio annotations belonging to an audio document.

Module Contents#

class medkit.core.audio.annotation_container.AudioAnnotationContainer(doc_id: str, raw_segment: medkit.core.audio.annotation.Segment)#

Bases: medkit.core.annotation_container.AnnotationContainer[medkit.core.audio.annotation.Segment]

Manage a list of audio annotations belonging to an audio document.

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

Also provides handling of raw segment.

raw_segment#
add(ann: medkit.core.audio.annotation.Segment)#

Attach an annotation to the document.

Parameters:
annAnnotationType

Annotation to add.

Raises:
ValueError

If the annotation is already attached to the document (based on annotation.uid)

get(*, label: str | None = None, key: str | None = None) list[medkit.core.audio.annotation.Segment]#

Return a list of the annotations of the document.

Parameters:
labelstr, optional

Label to use to filter annotations.

keystr, optional

Key to use to filter annotations.

get_by_id(uid) medkit.core.audio.annotation.Segment#

Return the annotation corresponding to a specific identifier.

Parameters:
uidstr

Identifier of the annotation to return.