Refactor transcribe segment

This commit is contained in:
2025-01-20 12:46:20 +01:00
parent 99ff06ff17
commit 163d4a6e4a

View File

@@ -95,14 +95,13 @@ class Transcriber:
vad_parameters={"min_silence_duration_ms": 500}, vad_parameters={"min_silence_duration_ms": 500},
) )
text = "" segments = list(segments)
words = [] text = "".join(segment.text for segment in segments)
for segment in segments: words = [
text += segment.text {"word": word.word, "start": word.start, "end": word.end}
words.extend( for segment in segments
{"word": word.word, "start": word.start, "end": word.end} for word in segment.words
for word in segment.words ]
)
return {"text": text, "words": words} return {"text": text, "words": words}