From b37e7b15e02fe8ac42c6591650dc2bfe86b1e8ac Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期三, 22 五月 2024 15:11:08 +0800
Subject: [PATCH] wenetspeech
---
examples/aishell/paraformer/utils/text2token.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/examples/aishell/paraformer/utils/text2token.py b/examples/aishell/paraformer/utils/text2token.py
index 263cb9d..a89679f 100755
--- a/examples/aishell/paraformer/utils/text2token.py
+++ b/examples/aishell/paraformer/utils/text2token.py
@@ -60,6 +60,12 @@
read from SI1279.PHN file -> "sil b r ih sil k s aa r er n aa l
sil t er n ih sil t ih v sil" """,
)
+ parser.add_argument(
+ "--text_format",
+ default="text",
+ type=str,
+ help="text, jsonl",
+ )
return parser
@@ -82,6 +88,9 @@
line = f.readline()
n = args.nchar
while line:
+ if args.text_format == "jsonl":
+ data = json.loads(line.strip())
+ line = data["target"]
x = line.split()
print(" ".join(x[: args.skip_ncols]), end=" ")
a = " ".join(x[args.skip_ncols :])
--
Gitblit v1.9.1