LAP-DEV commited on
Commit
51cf04f
·
verified ·
1 Parent(s): 6e270b6

Update modules/vad/silero_vad.py

Browse files
Files changed (1) hide show
  1. modules/vad/silero_vad.py +5 -5
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["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:
 
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: