From 6e69d784e4814c3dbe35e8f70c6cf4b920c8b20b Mon Sep 17 00:00:00 2001
From: 天地 <tiandiweizun@gmail.com>
Date: 星期三, 19 三月 2025 23:10:13 +0800
Subject: [PATCH] 1. bug fix:list(mean)和list(var),由于mean和var是numpy,导致写入到文件的格式错误,参考上面的话,大概率是list(mean.tolist()),其实外层list没有必要 (#2437)
---
runtime/tools/fst/ctc_token_fst.py | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/runtime/tools/fst/ctc_token_fst.py b/runtime/tools/fst/ctc_token_fst.py
index e4cdabd..5f06e52 100755
--- a/runtime/tools/fst/ctc_token_fst.py
+++ b/runtime/tools/fst/ctc_token_fst.py
@@ -4,21 +4,20 @@
import sys
-with open(sys.argv[1], 'r') as fread:
- print('0 0 <blank> <eps>')
+with open(sys.argv[1], "r") as fread:
+ print("0 0 <blank> <eps>")
nodeX = 1
for entry in fread.readlines():
- entry = entry.replace('\n', '').strip()
- fields = entry.split(' ')
+ entry = entry.replace("\n", "").strip()
+ fields = entry.split(" ")
phone = fields[0]
- if phone == '<eps>' or phone == '<blank>':
+ if phone == "<eps>" or phone == "<blank>":
continue
- if '#' in phone:
- print(str(0) + ' ' + str(0) + ' ' + '<eps>' + ' ' + phone)
+ if "#" in phone:
+ print(str(0) + " " + str(0) + " " + "<eps>" + " " + phone)
else:
- print(str(0) + ' ' + str(nodeX) + ' ' + phone + ' ' + phone)
- print(str(nodeX) + ' ' + str(nodeX) + ' ' + phone + ' <eps>')
- print(str(nodeX) + ' ' + str(0) + ' ' + '<eps> <eps>')
+ print(str(0) + " " + str(nodeX) + " " + phone + " " + phone)
+ print(str(nodeX) + " " + str(nodeX) + " " + phone + " <eps>")
+ print(str(nodeX) + " " + str(0) + " " + "<eps> <eps>")
nodeX += 1
- print('0')
-
+ print("0")
--
Gitblit v1.9.1