medkit.core.audio.annotation#

Classes:

Segment(label, audio, span[, attrs, ...])

Audio segment referencing part of an AudioDocument.

class Segment(label, audio, span, attrs=None, metadata=None, uid=None)[source]#

Audio segment referencing part of an AudioDocument.

Variables
  • uid (str) – Unique identifier of the segment.

  • label (str) – Label of the segment.

  • audio (medkit.core.audio.audio_buffer.AudioBuffer) – The audio signal of the segment. It must be consistent with the span, in the sense that it must correspond to the audio signal of the document at the span boundaries. But it can be a modified, processed version of this audio signal.

  • span (medkit.core.audio.span.Span) – Span (in seconds) indicating the part of the document’s full signal that this segment references.

  • attrs (medkit.core.attribute_container.AttributeContainer) – Attributes of the segment. Stored in a :class:{~medkit.core.AttributeContainer} but can be passed as a list at init.

  • metadata (Dict[str, Any]) – Metadata of the segment.

  • keys (Set[str]) – Pipeline output keys to which the annotation belongs to.

Methods:

get_subclass_for_data_dict(data_dict)

Return the subclass that corresponds to the class name found in a data dict

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.