From d80ac2fd2df4e7fb8a28acfa512bb11472b5cc99 Mon Sep 17 00:00:00 2001
From: liugz18 <57401541+liugz18@users.noreply.github.com>
Date: 星期四, 18 七月 2024 21:34:55 +0800
Subject: [PATCH] Rename 'res' in line 514 to avoid with naming conflict with line 365
---
runtime/onnxruntime/src/util.cpp | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/runtime/onnxruntime/src/util.cpp b/runtime/onnxruntime/src/util.cpp
index 039fa90..483795e 100644
--- a/runtime/onnxruntime/src/util.cpp
+++ b/runtime/onnxruntime/src/util.cpp
@@ -590,8 +590,8 @@
// format
ts_sent += "{\"text_seg\":\"" + text_seg + "\",";
ts_sent += "\"punc\":\"" + characters[idx_str] + "\",";
- ts_sent += "\"start\":\"" + to_string(start) + "\",";
- ts_sent += "\"end\":\"" + to_string(end) + "\",";
+ ts_sent += "\"start\":" + to_string(start) + ",";
+ ts_sent += "\"end\":" + to_string(end) + ",";
ts_sent += "\"ts_list\":" + VectorToString(ts_seg, false) + "}";
if (idx_str == characters.size()-1){
@@ -627,8 +627,8 @@
// format
ts_sent += "{\"text_seg\":\"" + text_seg + "\",";
ts_sent += "\"punc\":\"\",";
- ts_sent += "\"start\":\"" + to_string(start) + "\",";
- ts_sent += "\"end\":\"" + to_string(end) + "\",";
+ ts_sent += "\"start\":" + to_string(start) + ",";
+ ts_sent += "\"end\":" + to_string(end) + ",";
ts_sent += "\"ts_list\":" + VectorToString(ts_seg, false) + "}";
ts_sentences += ts_sent;
}
@@ -870,6 +870,15 @@
sum -=(1.0 - 1e-4);
}
}
+ // fix case: sum > 1
+ int cif_idx = cif_peak.size()-1;
+ while(sum>=1.0 - 1e-4 && cif_idx >= 0 ){
+ if(cif_peak[cif_idx] < 1.0 - 1e-4){
+ cif_peak[cif_idx] = sum;
+ sum -=(1.0 - 1e-4);
+ }
+ cif_idx--;
+ }
fire_place.clear();
for (int i = 0; i < num_frames; i++) {
--
Gitblit v1.9.1