mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
make TrieManager.hpp looks better
This commit is contained in:
parent
12a4eea111
commit
d8e00f7d62
@ -23,11 +23,14 @@ namespace CppJieba
|
||||
LogError("error when getting md5 for file '%s'", dictpath);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogInfo("md5 for file '%s': %s", dictpath, md5.c_str());
|
||||
if (_tries.find(md5) == _tries.end())
|
||||
|
||||
if (_tries.find(md5) != _tries.end())
|
||||
{
|
||||
LogInfo("find a exits trie for md5: '%s'", md5.c_str());
|
||||
return _tries[md5.c_str()];
|
||||
}
|
||||
|
||||
LogInfo("create a new trie for md5: '%s'", md5.c_str());
|
||||
Trie* trie = NULL;
|
||||
try
|
||||
@ -40,7 +43,10 @@ namespace CppJieba
|
||||
return NULL;
|
||||
}
|
||||
if (NULL == trie)
|
||||
{
|
||||
LogError("get NULL from new trie for file '%s'", dictpath);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!trie->init())
|
||||
{
|
||||
@ -59,13 +65,6 @@ namespace CppJieba
|
||||
_tries[md5.c_str()] = trie;
|
||||
return trie;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogInfo("find a exits trie for md5: '%s'", md5.c_str());
|
||||
return _tries[md5.c_str()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static TrieManager& getInstance()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user