mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
remove isLeaf is flag
This commit is contained in:
parent
61f542a6b1
commit
d3dc0ff240
12
src/Trie.hpp
12
src/Trie.hpp
@ -30,9 +30,8 @@ namespace CppJieba
|
||||
struct TrieNode
|
||||
{
|
||||
TrieNodeMap hmap;
|
||||
bool isLeaf;
|
||||
const TrieNodeInfo * ptTrieNodeInfo;
|
||||
TrieNode(): isLeaf(false), ptTrieNodeInfo(NULL)
|
||||
TrieNode(): ptTrieNodeInfo(NULL)
|
||||
{}
|
||||
};
|
||||
|
||||
@ -104,11 +103,7 @@ namespace CppJieba
|
||||
}
|
||||
p = citer->second;
|
||||
}
|
||||
if(p->isLeaf)
|
||||
{
|
||||
return p->ptTrieNodeInfo;
|
||||
}
|
||||
return NULL;
|
||||
return p->ptTrieNodeInfo;
|
||||
}
|
||||
|
||||
bool find(Unicode::const_iterator begin, Unicode::const_iterator end, DagType & res, size_t offset = 0) const
|
||||
@ -123,7 +118,7 @@ namespace CppJieba
|
||||
break;
|
||||
}
|
||||
p = citer->second;
|
||||
if(p->isLeaf)
|
||||
if(p->ptTrieNodeInfo)
|
||||
{
|
||||
res[itr - begin + offset] = p->ptTrieNodeInfo;
|
||||
}
|
||||
@ -157,7 +152,6 @@ namespace CppJieba
|
||||
|
||||
}
|
||||
|
||||
ptNode->isLeaf = true;
|
||||
ptNode->ptTrieNodeInfo = &nodeInfo;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user