in function_app/src/helpers/content_understanding.py [0:0]
def condense_webvtt_transcription(webvtt_str: str) -> str:
"""
Condense a WEBVTT transcription into a more readable format.
:param transcription_md:
The transcription in markdown format.
:return:
The condensed transcription string.
"""
processed_captions = []
for caption in webvtt.from_string(webvtt_str):
_start_hour, start_min, start_sec = caption.start.split(":")
start_sec = start_sec.split(".")[0]
processed_captions.append(
f"[{start_min}:{start_sec}] {caption.voice}: {caption.text}"
)
return "\n".join(processed_captions)