Update modules/vad/silero_vad.py
Browse files
modules/vad/silero_vad.py
CHANGED
@@ -260,14 +260,14 @@ class SileroVAD:
|
|
260 |
words = []
|
261 |
for word in segment["text"]:
|
262 |
# Ensure the word start and end times are resolved to the same chunk.
|
263 |
-
middle = (word
|
264 |
chunk_index = ts_map.get_chunk_index(middle)
|
265 |
-
word
|
266 |
-
word
|
267 |
words.append(word)
|
268 |
|
269 |
-
segment["start"] = words[0]
|
270 |
-
segment["end"] = words[-1]
|
271 |
segment["text"] = words
|
272 |
|
273 |
else:
|
|
|
260 |
words = []
|
261 |
for word in segment["text"]:
|
262 |
# Ensure the word start and end times are resolved to the same chunk.
|
263 |
+
middle = (word.start + word.end) / 2
|
264 |
chunk_index = ts_map.get_chunk_index(middle)
|
265 |
+
word.start = ts_map.get_original_time(word.start, chunk_index)
|
266 |
+
word.end = ts_map.get_original_time(word.end, chunk_index)
|
267 |
words.append(word)
|
268 |
|
269 |
+
segment["start"] = words[0].start
|
270 |
+
segment["end"] = words[-1].end
|
271 |
segment["text"] = words
|
272 |
|
273 |
else:
|