From 66a8235fbfc88401a942cb7161504ee9600d6b75 Mon Sep 17 00:00:00 2001
From: speech_asr <wangjiaming.wjm@alibaba-inc.com>
Date: 星期二, 14 二月 2023 14:45:39 +0800
Subject: [PATCH] add wav/text mismatch process

---
 funasr/utils/wav_utils.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/funasr/utils/wav_utils.py b/funasr/utils/wav_utils.py
index afc0ec9..76ed678 100644
--- a/funasr/utils/wav_utils.py
+++ b/funasr/utils/wav_utils.py
@@ -298,11 +298,17 @@
     os.rename(text_file, "{}.bak".format(text_file))
     wav_dict = {}
     for line in wav_lines:
-        sample_name, wav_path = line.strip().split()
+        parts = line.strip().split()
+        if len(parts) < 2:
+            continue
+        sample_name, wav_path = parts
         wav_dict[sample_name] = wav_path
     text_dict = {}
     for line in text_lines:
-        sample_name, txt = line.strip().split(" ", 1)
+        parts = line.strip().split(" ", 1)
+        if len(parts) < 2:
+            continue
+        sample_name, txt = parts
         text_dict[sample_name] = txt
     filter_count = 0
     with open(wav_file) as f_wav, open(text_file) as f_text:

--
Gitblit v1.9.1