mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
use assert for getinitflag
This commit is contained in:
parent
acb4150e3c
commit
1e29d25855
@ -3,6 +3,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
#include "Limonp/logger.hpp"
|
||||
#include "Trie.hpp"
|
||||
#include "ISegment.hpp"
|
||||
@ -63,15 +64,16 @@ namespace CppJieba
|
||||
public:
|
||||
bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<Unicode>& res) const
|
||||
{
|
||||
assert(_getInitFlag());
|
||||
#ifndef NO_CODING_LOG
|
||||
if (!_getInitFlag())
|
||||
//if (!_getInitFlag())
|
||||
//{
|
||||
// LogError("not inited.");
|
||||
// return false;
|
||||
//}
|
||||
if (begin >= end)
|
||||
{
|
||||
LogError("not inited.");
|
||||
return false;
|
||||
}
|
||||
if (begin > end)
|
||||
{
|
||||
LogError("begin > end");
|
||||
LogError("begin >= end");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <memory.h>
|
||||
#include <cassert>
|
||||
#include "Limonp/str_functs.hpp"
|
||||
#include "Limonp/logger.hpp"
|
||||
#include "TransCode.hpp"
|
||||
@ -93,11 +94,12 @@ namespace CppJieba
|
||||
public:
|
||||
virtual bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<string>& res)const
|
||||
{
|
||||
if(!_getInitFlag())
|
||||
{
|
||||
LogError("not inited.");
|
||||
return false;
|
||||
}
|
||||
//if(!_getInitFlag())
|
||||
//{
|
||||
// LogError("not inited.");
|
||||
// return false;
|
||||
//}
|
||||
assert(_getInitFlag());
|
||||
if(begin == end)
|
||||
{
|
||||
return false;
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
#include "Limonp/logger.hpp"
|
||||
#include "Trie.hpp"
|
||||
#include "ISegment.hpp"
|
||||
@ -73,11 +74,13 @@ namespace CppJieba
|
||||
public:
|
||||
virtual bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<string>& res)const
|
||||
{
|
||||
if(!_getInitFlag())
|
||||
{
|
||||
LogError("not inited.");
|
||||
return false;
|
||||
}
|
||||
//if(!_getInitFlag())
|
||||
//{
|
||||
// LogError("not inited.");
|
||||
// return false;
|
||||
//}
|
||||
assert(_getInitFlag());
|
||||
|
||||
vector<TrieNodeInfo> segWordInfos;
|
||||
if(!cut(begin, end, segWordInfos))
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef CPPJIEBA_MIXSEGMENT_H
|
||||
#define CPPJIEBA_MIXSEGMENT_H
|
||||
|
||||
#include <cassert>
|
||||
#include "MPSegment.hpp"
|
||||
#include "HMMSegment.hpp"
|
||||
#include "Limonp/str_functs.hpp"
|
||||
@ -56,11 +57,12 @@ namespace CppJieba
|
||||
public:
|
||||
virtual bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<string>& res)const
|
||||
{
|
||||
if(!_getInitFlag())
|
||||
{
|
||||
LogError("not inited.");
|
||||
return false;
|
||||
}
|
||||
//if(!_getInitFlag())
|
||||
//{
|
||||
// LogError("not inited.");
|
||||
// return false;
|
||||
//}
|
||||
assert(_getInitFlag());
|
||||
if(begin == end)
|
||||
{
|
||||
return false;
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
#include "Limonp/logger.hpp"
|
||||
#include "Trie.hpp"
|
||||
#include "ISegment.hpp"
|
||||
@ -64,15 +65,16 @@ namespace CppJieba
|
||||
public:
|
||||
bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<Unicode>& res) const
|
||||
{
|
||||
assert(_getInitFlag());
|
||||
#ifndef NO_CODING_LOG
|
||||
if (!_getInitFlag())
|
||||
//if (!_getInitFlag())
|
||||
//{
|
||||
// LogError("not inited.");
|
||||
// return false;
|
||||
//}
|
||||
if (begin >= end)
|
||||
{
|
||||
LogError("not inited.");
|
||||
return false;
|
||||
}
|
||||
if (begin > end)
|
||||
{
|
||||
LogError("begin > end");
|
||||
LogError("begin >= end");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user