Skip to content

Commit

Permalink
Keep segment timestamps aligned with words timestamps after VAD (SYST…
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumekln authored Apr 6, 2023
1 parent 051b335 commit e9a082d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions faster_whisper/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,14 +776,18 @@ def restore_speech_timestamps(
end=ts_map.get_original_time(word.end, chunk_index),
)
words.append(word)
else:
words = segment.words

segment = segment._replace(
start=ts_map.get_original_time(segment.start),
end=ts_map.get_original_time(segment.end),
words=words,
)
segment = segment._replace(
start=words[0].start,
end=words[-1].end,
words=words,
)

else:
segment = segment._replace(
start=ts_map.get_original_time(segment.start),
end=ts_map.get_original_time(segment.end),
)

yield segment

Expand Down

0 comments on commit e9a082d

Please sign in to comment.