medkit.io.medkit_json.audio
medkit.io.medkit_json.audio#
Functions:
|
Load audio annotations from a medkit-json file generated with |
|
Load an audio document from a medkit-json file generated with |
|
Load audio documents from a medkit-json file generated with |
|
Save audio annotations into a medkit-json file. |
|
Save an audio document into a medkit-json file. |
|
Save audio documents into a medkit-json file. |
- load_audio_document(input_file, anns_input_file=None, encoding='utf-8')[source]#
Load an audio document from a medkit-json file generated with
save_audio_document()
- Parameters
input_file (
Union
[str
,Path
]) – Path to the medkit-json file containing the documentanns_input_file (
Union
[str
,Path
,None
]) – Optional medkit-json file containing separate annotations of the document.encoding (
Optional
[str
]) – Optional encoding of input_file and anns_input_file
- Return type
- Returns
AudioDocument – The audio document in the file
- load_audio_documents(input_file, encoding='utf-8')[source]#
Load audio documents from a medkit-json file generated with
save_audio_documents()
- Parameters
input_file (
Union
[str
,Path
]) – Path to the medkit-json file containing the documentsencoding (
Optional
[str
]) – Optional encoding of input_file
- Return type
Iterator
[AudioDocument
]- Returns
Iterator[AudioDocument] – An iterator to the audio documents in the file
- load_audio_anns(input_file, encoding='utf-8')[source]#
Load audio annotations from a medkit-json file generated with
save_audio_anns()
- Parameters
input_file (
Union
[str
,Path
]) – Path to the medkit-json file containing the annotationsencoding (
Optional
[str
]) – Optional encoding of input_file
- Return type
Iterator
[Segment
]- Returns
Iterator[Segment] – An iterator to the audio annotations in the file
- save_audio_document(doc, output_file, split_anns=False, anns_output_file=None, encoding='utf-8')[source]#
Save an audio document into a medkit-json file.
- Parameters
doc (
AudioDocument
) – The audio document to saveoutput_file (
Union
[str
,Path
]) – Path of the generated medkit-json filesplit_anns (
bool
) – If True, the annotations will be saved in a separate medkit-json file instead of being included in the main document fileanns_output_file (
Union
[str
,Path
,None
]) – Path of the medkit-json file storing the annotations if split_anns is True. If not provided, output_file will be used with an extra “_anns” suffix.encoding (
Optional
[str
]) – Optional encoding of output_file and anns_output_file
- save_audio_documents(docs, output_file, encoding='utf-8')[source]#
Save audio documents into a medkit-json file.
- Parameters
docs (
Iterable
[AudioDocument
]) – The audio documents to saveoutput_file (
Union
[str
,Path
]) – Path of the generated medkit-json fileencoding (
Optional
[str
]) – Optional encoding of output_file