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},
)
text = ""
words = []
for segment in segments:
text += segment.text
words.extend(
segments = list(segments)
text = "".join(segment.text for segment in segments)
words = [
{"word": word.word, "start": word.start, "end": word.end}
for segment in segments
for word in segment.words
)
]
return {"text": text, "words": words}