MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / ParseUserDictValues

Function ParseUserDictValues

plugins/jieba/tools/cppjieba_dict.cpp:97–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97std::vector<std::string> ParseUserDictValues(const std::vector<std::string>& tokens,
98 size_t line_number) {
99 if (tokens.empty() || tokens.size() > 3) {
100 throw std::runtime_error("invalid user dict line " +
101 std::to_string(line_number));
102 }
103 if (tokens.size() == 1) {
104 return std::vector<std::string>{"", "", "user_default"};
105 }
106 if (tokens.size() == 2) {
107 return std::vector<std::string>{"", tokens[1], "user_default"};
108 }
109 return std::vector<std::string>{tokens[1], tokens[2], "user_freq"};
110}
111
112class LexiconDict : public Dict {
113public:

Callers 1

LoadUserDictFunction · 0.85

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected