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/vocab.h | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/runtime/onnxruntime/src/vocab.h b/runtime/onnxruntime/src/vocab.h
index 8834b97..36fabf4 100644
--- a/runtime/onnxruntime/src/vocab.h
+++ b/runtime/onnxruntime/src/vocab.h
@@ -6,6 +6,7 @@
#include <string>
#include <vector>
#include <map>
+#include "nlohmann/json.hpp"
using namespace std;
namespace funasr {
@@ -13,11 +14,15 @@
private:
vector<string> vocab;
std::map<string, int> token_id;
+ std::map<string, string> lex_map;
bool IsEnglish(string ch);
void LoadVocabFromYaml(const char* filename);
+ void LoadVocabFromJson(const char* filename);
+ void LoadLex(const char* filename);
public:
Vocab(const char *filename);
+ Vocab(const char *filename, const char *lex_file);
~Vocab();
int Size() const;
bool IsChinese(string ch);
@@ -26,7 +31,8 @@
string Vector2StringV2(vector<int> in, std::string language="");
string Id2String(int id) const;
string WordFormat(std::string word);
- int GetIdByToken(const std::string &token);
+ int GetIdByToken(const std::string &token) const;
+ string Word2Lex(const std::string &word) const;
};
} // namespace funasr
--
Gitblit v1.9.1