From fa9a6cdb1eade68c258eed7297f5a8a8a5329ac6 Mon Sep 17 00:00:00 2001
From: Flute <41096447+fluteink@users.noreply.github.com>
Date: 星期三, 01 十月 2025 14:44:28 +0800
Subject: [PATCH] 更新文档和运行脚本,修复文档拼写错误 (#2688)
---
examples/aishell/paraformer/utils/text2token.py | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/examples/aishell/paraformer/utils/text2token.py b/examples/aishell/paraformer/utils/text2token.py
index 263cb9d..c39db1e 100755
--- a/examples/aishell/paraformer/utils/text2token.py
+++ b/examples/aishell/paraformer/utils/text2token.py
@@ -8,6 +8,7 @@
import codecs
import re
import sys
+import json
is_python2 = sys.version_info[0] == 2
@@ -60,6 +61,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 +89,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