rename Trie -> DictTrie

This commit is contained in:
wyy 2014-04-10 21:07:11 +08:00
parent f70b654b66
commit abd23a4d79
6 changed files with 21 additions and 21 deletions

View File

@ -12,7 +12,7 @@
#include "Limonp/logger.hpp"
#include "Limonp/InitOnOff.hpp"
#include "TransCode.hpp"
#include "Trie.hpp"
#include "DictTrie.hpp"

View File

@ -5,7 +5,7 @@
#include <set>
#include <cassert>
#include "Limonp/logger.hpp"
#include "Trie.hpp"
#include "DictTrie.hpp"
#include "ISegment.hpp"
#include "SegmentBase.hpp"
#include "TransCode.hpp"
@ -15,7 +15,7 @@ namespace CppJieba
class FullSegment: public SegmentBase
{
private:
Trie _trie;
DictTrie _dictTrie;
public:
FullSegment(){_setInitFlag(false);};
@ -29,8 +29,8 @@ namespace CppJieba
LogError("already inited before now.");
return false;
}
_trie.init(dictPath.c_str());
assert(_trie);
_dictTrie.init(dictPath.c_str());
assert(_dictTrie);
return _setInitFlag(true);
}
@ -61,7 +61,7 @@ namespace CppJieba
for (Unicode::const_iterator uItr = begin; uItr != end; uItr++)
{
//find word start from uItr
if (_trie.find(uItr, end, tRes, 0))
if (_dictTrie.find(uItr, end, tRes, 0))
{
for(DagType::const_iterator itr = tRes.begin(); itr != tRes.end(); itr++)
//for (vector<pair<size_t, const TrieNodeInfo*> >::const_iterator itr = tRes.begin(); itr != tRes.end(); itr++)

View File

@ -10,7 +10,7 @@
#include "TransCode.hpp"
#include "ISegment.hpp"
#include "SegmentBase.hpp"
#include "Trie.hpp"
#include "DictTrie.hpp"
namespace CppJieba
{

View File

@ -9,8 +9,8 @@
#include <set>
#include <cassert>
#include "Limonp/logger.hpp"
#include "Trie.hpp"
#include "Trie.hpp"
#include "DictTrie.hpp"
#include "DictTrie.hpp"
#include "ISegment.hpp"
#include "SegmentBase.hpp"
@ -32,7 +32,7 @@ namespace CppJieba
class MPSegment: public SegmentBase
{
protected:
Trie _trie;
DictTrie _dictTrie;
public:
MPSegment(){_setInitFlag(false);};
@ -49,8 +49,8 @@ namespace CppJieba
LogError("already inited before now.");
return false;
}
_trie.init(dictPath);
assert(_trie);
_dictTrie.init(dictPath);
assert(_dictTrie);
LogInfo("MPSegment init(%s) ok", dictPath.c_str());
return _setInitFlag(true);
}
@ -124,7 +124,7 @@ namespace CppJieba
schar.uniCh = *it;
offset = it - begin;
schar.dag.clear();
_trie.find(it, end, schar.dag, offset);
_dictTrie.find(it, end, schar.dag, offset);
if(!isIn(schar.dag, offset))
{
schar.dag[offset] = NULL;
@ -165,7 +165,7 @@ namespace CppJieba
}
else
{
val += _trie.getMinLogFreq();
val += _dictTrie.getMinLogFreq();
}
if(val > segContext[i].weight)
{

View File

@ -3,7 +3,7 @@
#include "MixSegment.hpp"
#include "Limonp/str_functs.hpp"
#include "Trie.hpp"
#include "DictTrie.hpp"
namespace CppJieba
{
@ -13,7 +13,7 @@ namespace CppJieba
{
private:
MixSegment _segment;
Trie _trie;
DictTrie _dictTrie;
public:
PosTagger(){_setInitFlag(false);};
@ -27,8 +27,8 @@ namespace CppJieba
{
assert(!_getInitFlag());
_trie.init(dictPath);
assert(_trie);
_dictTrie.init(dictPath);
assert(_dictTrie);
return _setInitFlag(_segment.init(dictPath, hmmFilePath));
};
@ -51,7 +51,7 @@ namespace CppJieba
LogError("decode failed.");
return false;
}
tmp = _trie.find(unico.begin(), unico.end());
tmp = _dictTrie.find(unico.begin(), unico.end());
res.push_back(make_pair(*itr, tmp == NULL ? "x" : tmp->tag));
}
tmp = NULL;

View File

@ -5,13 +5,13 @@
#include <set>
#include <cassert>
#include "Limonp/logger.hpp"
#include "Trie.hpp"
#include "DictTrie.hpp"
#include "ISegment.hpp"
#include "SegmentBase.hpp"
#include "FullSegment.hpp"
#include "MixSegment.hpp"
#include "TransCode.hpp"
#include "Trie.hpp"
#include "DictTrie.hpp"
namespace CppJieba
{