From a05e753d11d9c36983ec4e58c421dbcf86d1dcd4 Mon Sep 17 00:00:00 2001
From: Xian Shi <40013335+R1ckShi@users.noreply.github.com>
Date: 星期二, 17 十月 2023 16:47:27 +0800
Subject: [PATCH] Merge branch 'main' into dev_onnx

---
 funasr/runtime/onnxruntime/src/vocab.h |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/funasr/runtime/onnxruntime/src/vocab.h b/funasr/runtime/onnxruntime/src/vocab.h
index 6c4e523..23b4bd6 100644
--- a/funasr/runtime/onnxruntime/src/vocab.h
+++ b/funasr/runtime/onnxruntime/src/vocab.h
@@ -5,13 +5,14 @@
 #include <stdint.h>
 #include <string>
 #include <vector>
+#include <map>
 using namespace std;
 
 namespace funasr {
 class Vocab {
   private:
     vector<string> vocab;
-    bool IsChinese(string ch);
+    std::map<string, int> token_id;
     bool IsEnglish(string ch);
     void LoadVocabFromYaml(const char* filename);
 
@@ -19,8 +20,11 @@
     Vocab(const char *filename);
     ~Vocab();
     int Size();
-    string Vector2String(vector<int> in);
-    string Vector2StringV2(vector<int> in);
+    bool IsChinese(string ch);
+    void Vector2String(vector<int> in, std::vector<std::string> &preds);
+    string Vector2StringV2(vector<int> in, std::string language="");
+    string WordFormat(std::string word);
+    int GetIdByToken(const std::string &token);
 };
 
 } // namespace funasr

--
Gitblit v1.9.1