From abd23a4d79febe54c317ce58da657dc17cc33b0c Mon Sep 17 00:00:00 2001 From: wyy Date: Thu, 10 Apr 2014 21:07:11 +0800 Subject: [PATCH] rename Trie -> DictTrie --- src/DictTrie.hpp | 2 +- src/FullSegment.hpp | 10 +++++----- src/HMMSegment.hpp | 2 +- src/MPSegment.hpp | 14 +++++++------- src/PosTagger.hpp | 10 +++++----- src/QuerySegment.hpp | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/DictTrie.hpp b/src/DictTrie.hpp index 4f5700a..59c2e69 100644 --- a/src/DictTrie.hpp +++ b/src/DictTrie.hpp @@ -12,7 +12,7 @@ #include "Limonp/logger.hpp" #include "Limonp/InitOnOff.hpp" #include "TransCode.hpp" -#include "Trie.hpp" +#include "DictTrie.hpp" diff --git a/src/FullSegment.hpp b/src/FullSegment.hpp index ec97067..fa55cde 100644 --- a/src/FullSegment.hpp +++ b/src/FullSegment.hpp @@ -5,7 +5,7 @@ #include #include #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 >::const_iterator itr = tRes.begin(); itr != tRes.end(); itr++) diff --git a/src/HMMSegment.hpp b/src/HMMSegment.hpp index 41c5a77..6fe25c5 100644 --- a/src/HMMSegment.hpp +++ b/src/HMMSegment.hpp @@ -10,7 +10,7 @@ #include "TransCode.hpp" #include "ISegment.hpp" #include "SegmentBase.hpp" -#include "Trie.hpp" +#include "DictTrie.hpp" namespace CppJieba { diff --git a/src/MPSegment.hpp b/src/MPSegment.hpp index 8a648a9..b22d21d 100644 --- a/src/MPSegment.hpp +++ b/src/MPSegment.hpp @@ -9,8 +9,8 @@ #include #include #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) { diff --git a/src/PosTagger.hpp b/src/PosTagger.hpp index 79bacd9..c760c0b 100644 --- a/src/PosTagger.hpp +++ b/src/PosTagger.hpp @@ -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; diff --git a/src/QuerySegment.hpp b/src/QuerySegment.hpp index 93a207a..0e8fbac 100644 --- a/src/QuerySegment.hpp +++ b/src/QuerySegment.hpp @@ -5,13 +5,13 @@ #include #include #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 {