Keep segment timestamps aligned with words timestamps after VAD (#119)
This commit is contained in:
@@ -776,14 +776,18 @@ def restore_speech_timestamps(
|
|||||||
end=ts_map.get_original_time(word.end, chunk_index),
|
end=ts_map.get_original_time(word.end, chunk_index),
|
||||||
)
|
)
|
||||||
words.append(word)
|
words.append(word)
|
||||||
else:
|
|
||||||
words = segment.words
|
|
||||||
|
|
||||||
segment = segment._replace(
|
segment = segment._replace(
|
||||||
start=ts_map.get_original_time(segment.start),
|
start=words[0].start,
|
||||||
end=ts_map.get_original_time(segment.end),
|
end=words[-1].end,
|
||||||
words=words,
|
words=words,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
segment = segment._replace(
|
||||||
|
start=ts_map.get_original_time(segment.start),
|
||||||
|
end=ts_map.get_original_time(segment.end),
|
||||||
|
)
|
||||||
|
|
||||||
yield segment
|
yield segment
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user