medkit.audio.transcription.transcribed_document#

Classes:

TranscribedDocument(text, ...[, anns, ...])

Subclass for TextDocument instances generated by audio transcription.

class TranscribedDocument(text, text_spans_to_audio_spans, audio_doc_id, anns=None, metadata=None, uid=None)[source]#

Subclass for TextDocument instances generated by audio transcription.

Variables

Methods:

from_dict(doc_dict)

Create a TranscribedDocument from a dict

get_containing_audio_spans(text_ann_spans)

Return the audio spans used to transcribe the text referenced by a text annotation.

get_containing_audio_spans(text_ann_spans)[source]#

Return the audio spans used to transcribe the text referenced by a text annotation.

For instance, if the audio ranging from 1.0 to 20.0 seconds is transcribed to some text ranging from character 10 to 56 in the transcribed document, and then a text annotation is created referencing the span 15 to 25, then the containing audio span will be the one ranging from 1.0 to 20.0 seconds.

Note that some text annotations maybe be contained in more that one audio spans.

Parameters

text_ann_spans (List[AnySpan]) – Text spans of a text annotation referencing some characters in the transcribed document.

Return type

List[Span]

Returns

List[AudioSpan] – Audio spans used to transcribe the text referenced by the spans of text_ann.

classmethod from_dict(doc_dict)[source]#

Create a TranscribedDocument from a dict

Parameters

doc_dict (Dict[str, Any]) – A dictionary from a serialized TranscribedDocument as generated by to_dict()

Return type

Self