virtual bool dispose() { if(!_getInitFlag()) { return true; } _trie.dispose(); _setInitFlag(false); return true; }
bool MixSegment::dispose() { if(!_getInitFlag()) { return true; } _mpSeg.dispose(); _hmmSeg.dispose(); _setInitFlag(false); return true; }
bool Trie::dispose() { if(!_getInitFlag()) { return false; } bool ret = _deleteNode(_root); if(!ret) { LogFatal("_deleteNode failed!"); return false; } _root = NULL; _nodeInfoVec.clear(); _setInitFlag(false); return ret; }
bool MixSegment::init(const char* const mpSegDict, const char* const hmmSegDict) { if(_getInitFlag()) { LogError("inited."); return false; } if(!_mpSeg.init(mpSegDict)) { LogError("_mpSeg init"); return false; } if(!_hmmSeg.init(hmmSegDict)) { LogError("_hmmSeg init"); return false; } return _setInitFlag(true); }
virtual bool init() { if(_getInitFlag()) { LogError("already inited before now."); return false; } if(!_trie.init()) { LogError("_trie.init failed."); return false; } LogInfo("_trie.loadDict(%s) start...", _dictPath.c_str()); if(!_trie.loadDict(_dictPath.c_str())) { LogError("_trie.loadDict faield."); return false; } LogInfo("_trie.loadDict end."); return _setInitFlag(true); }
bool Trie::init() { if(_getInitFlag()) { LogError("already initted!"); return false; } try { _root = new TrieNode; } catch(const bad_alloc& e) { return false; } if(NULL == _root) { return false; } _setInitFlag(true); return true; }
InitOnOff(){_setInitFlag(false);};