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

Function LoadBaseDict

plugins/jieba/tools/cppjieba_dict.cpp:183–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181};
182
183void LoadBaseDict(const std::string& path,
184 std::map<std::string, std::vector<std::string> >& entries) {
185 std::ifstream ifs(path.c_str());
186 if (!ifs.is_open()) {
187 throw std::runtime_error("failed to open base dict: " + path);
188 }
189
190 std::string line;
191 size_t line_number = 0;
192 while (std::getline(ifs, line)) {
193 ++line_number;
194 if (IsCommentOrEmpty(line)) {
195 continue;
196 }
197 const std::vector<std::string> tokens = SplitWhitespace(line);
198 entries[tokens[0]] = ParseBaseDictValues(tokens, line_number);
199 }
200}
201
202void LoadUserDict(const std::string& path,
203 std::map<std::string, std::vector<std::string> >& entries) {

Callers 1

mainFunction · 0.85

Calls 4

IsCommentOrEmptyFunction · 0.85
SplitWhitespaceFunction · 0.85
ParseBaseDictValuesFunction · 0.85
is_openMethod · 0.45

Tested by

no test coverage detected