From 5071e7b4b629338f84ca21ba0c9cdb12e68213d7 Mon Sep 17 00:00:00 2001
From: 雾聪 <wucong.lyb@alibaba-inc.com>
Date: 星期三, 20 十二月 2023 16:20:17 +0800
Subject: [PATCH] update TimestampSentence & TimestampIsPunctuation

---
 runtime/onnxruntime/src/util.cpp |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/runtime/onnxruntime/src/util.cpp b/runtime/onnxruntime/src/util.cpp
index ac793f5..661a50d 100644
--- a/runtime/onnxruntime/src/util.cpp
+++ b/runtime/onnxruntime/src/util.cpp
@@ -305,6 +305,10 @@
 }
 
 bool TimestampIsPunctuation(U16CHAR_T &u16) {
+    // (& ' -) in the dict
+    if (u16 == 0x26 || u16 == 0x27 || u16 == 0x2D){
+        return false;
+    }
     return (u16 >= 0x21 && u16 <= 0x2F)     // 鏍囧噯ASCII鏍囩偣
         || (u16 >= 0x3A && u16 <= 0x40)     // 鏍囧噯ASCII鏍囩偣
         || (u16 >= 0x5B && u16 <= 0x60)     // 鏍囧噯ASCII鏍囩偣
@@ -590,9 +594,7 @@
             } else{
                 ts_sentences += ts_sent + ",";
             }
-
             // clear
-            idx_str++;
             text_seg = "";
             ts_sent = "";
             start = 0;
@@ -605,9 +607,9 @@
                 text_seg += " " + characters[idx_str];
             }
             ts_seg.push_back(timestamps[idx_ts]);
-            idx_str++;
             idx_ts++;
         }
+        idx_str++;
     }
     // for none punc results
     if(ts_seg.size() >0){

--
Gitblit v1.9.1