From e0fa63765bfb4a36bde7047c2a6066ca5a80e90f Mon Sep 17 00:00:00 2001
From: Yabin Li <wucong.lyb@alibaba-inc.com>
Date: 星期一, 21 八月 2023 10:37:42 +0800
Subject: [PATCH] Dev hw (#878)
---
funasr/runtime/onnxruntime/src/vocab.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/funasr/runtime/onnxruntime/src/vocab.h b/funasr/runtime/onnxruntime/src/vocab.h
index 9b462b7..808852a 100644
--- a/funasr/runtime/onnxruntime/src/vocab.h
+++ b/funasr/runtime/onnxruntime/src/vocab.h
@@ -5,12 +5,14 @@
#include <stdint.h>
#include <string>
#include <vector>
+#include <map>
using namespace std;
namespace funasr {
class Vocab {
private:
vector<string> vocab;
+ std::map<string, int> token_id;
bool IsEnglish(string ch);
void LoadVocabFromYaml(const char* filename);
@@ -21,6 +23,7 @@
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
--
Gitblit v1.9.1