mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
modify calcDAG to speed up
This commit is contained in:
parent
15685d5cf2
commit
1169521c42
@ -157,25 +157,10 @@ namespace CppJieba
|
|||||||
LogError("begin >= end.");
|
LogError("begin >= end.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for(Unicode::const_iterator it = begin; it != end; it++)
|
|
||||||
{
|
|
||||||
segContext.push_back(SegmentChar(*it));
|
|
||||||
}
|
|
||||||
|
|
||||||
vector<pair<uint, const TrieNodeInfo*> > vp;
|
vector<pair<uint, const TrieNodeInfo*> > vp;
|
||||||
//for(Unicode::const_iterator it = begin; it != end; it++)
|
|
||||||
//{
|
|
||||||
// segContext.push_back(SegmentChar(*it));
|
|
||||||
//}
|
|
||||||
for(Unicode::const_iterator it = begin; it != end; it++)
|
for(Unicode::const_iterator it = begin; it != end; it++)
|
||||||
//for(uint i = 0; i < segContext.size(); i++)
|
|
||||||
{
|
{
|
||||||
//unicode.clear();
|
|
||||||
//for(uint j = i; j < segContext.size(); j++)
|
|
||||||
//{
|
|
||||||
// unicode.push_back(segContext[j].uniCh);
|
|
||||||
//}
|
|
||||||
|
|
||||||
segContext.push_back(SegmentChar(*it));
|
segContext.push_back(SegmentChar(*it));
|
||||||
SegmentChar& back = segContext.back();
|
SegmentChar& back = segContext.back();
|
||||||
int i = it - begin;
|
int i = it - begin;
|
||||||
|
@ -47,7 +47,7 @@ int main(int argc, char ** argv)
|
|||||||
// seg.dispose();
|
// seg.dispose();
|
||||||
//}
|
//}
|
||||||
{
|
{
|
||||||
MPSegment seg("../dicts/jieba.dict.utf8");
|
MixSegment seg("../dicts/jieba.dict.utf8", "../dicts/hmm_model.utf8");
|
||||||
if(!seg.init())
|
if(!seg.init())
|
||||||
{
|
{
|
||||||
cout<<"seg init failed."<<endl;
|
cout<<"seg init failed."<<endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user