From 2a66366be4c2715870e4859fd5a5db6e8a9dc00a Mon Sep 17 00:00:00 2001
From: chenmengzheAAA <123789350+chenmengzheAAA@users.noreply.github.com>
Date: 星期四, 14 九月 2023 19:00:17 +0800
Subject: [PATCH] Merge pull request #956 from alibaba-damo-academy/chenmengzheAAA-patch-4

---
 funasr/runtime/onnxruntime/src/vocab.h |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/funasr/runtime/onnxruntime/src/vocab.h b/funasr/runtime/onnxruntime/src/vocab.h
index 023671a..808852a 100644
--- a/funasr/runtime/onnxruntime/src/vocab.h
+++ b/funasr/runtime/onnxruntime/src/vocab.h
@@ -5,21 +5,26 @@
 #include <stdint.h>
 #include <string>
 #include <vector>
+#include <map>
 using namespace std;
 
+namespace funasr {
 class Vocab {
   private:
     vector<string> vocab;
-    bool isChinese(string ch);
-    bool isEnglish(string ch);
-    void loadVocabFromYaml(const char* filename);
+    std::map<string, int> token_id;
+    bool IsEnglish(string ch);
+    void LoadVocabFromYaml(const char* filename);
 
   public:
     Vocab(const char *filename);
     ~Vocab();
-    int size();
-    string vector2string(vector<int> in);
-    string vector2stringV2(vector<int> in);
+    int Size();
+    bool IsChinese(string ch);
+    void Vector2String(vector<int> in, std::vector<std::string> &preds);
+    string Vector2StringV2(vector<int> in);
+    int GetIdByToken(const std::string &token);
 };
 
+} // namespace funasr
 #endif

--
Gitblit v1.9.1