| | |
| | | #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 |