From ae49b2a8e1bc676e6014d8a12ebeec947b655e3e Mon Sep 17 00:00:00 2001
From: 莫拉古 <61447879+yechaoying@users.noreply.github.com>
Date: 星期五, 29 十一月 2024 09:55:43 +0800
Subject: [PATCH] 变量名写错了 (#2249)
---
funasr/utils/vad_utils.py | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/funasr/utils/vad_utils.py b/funasr/utils/vad_utils.py
index eba48a9..f87a85e 100644
--- a/funasr/utils/vad_utils.py
+++ b/funasr/utils/vad_utils.py
@@ -32,8 +32,10 @@
return speech_list, speech_lengths_list
-def merge_vad(vad_result, max_length=15000):
+def merge_vad(vad_result, max_length=15000, min_length=0):
new_result = []
+ if len(vad_result) <= 1:
+ return vad_result
time_step = [t[0] for t in vad_result] + [t[1] for t in vad_result]
time_step = sorted(list(set(time_step)))
if len(time_step) == 0:
@@ -43,13 +45,15 @@
time = time_step[i]
if time_step[i + 1] - bg < max_length:
continue
- if time - bg < max_length * 1.5:
+ if time - bg > min_length:
new_result.append([bg, time])
- else:
- split_num = int(time - bg) // max_length + 1
- spl_l = int(time - bg) // split_num
- for j in range(split_num):
- new_result.append([bg + j * spl_l, bg + (j + 1) * spl_l])
+ # if time - bg < max_length * 1.5:
+ # new_result.append([bg, time])
+ # else:
+ # split_num = int(time - bg) // max_length + 1
+ # spl_l = int(time - bg) // split_num
+ # for j in range(split_num):
+ # new_result.append([bg + j * spl_l, bg + (j + 1) * spl_l])
bg = time
new_result.append([bg, time_step[-1]])
- return new_result
+ return new_result
\ No newline at end of file
--
Gitblit v1.9.1