mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
add some log info
This commit is contained in:
parent
a90d37dae7
commit
86d8fc3130
10
Segment.cpp
10
Segment.cpp
@ -12,7 +12,9 @@ namespace CppJieba
|
|||||||
|
|
||||||
bool Segment::init(const char* const dictFilePath)
|
bool Segment::init(const char* const dictFilePath)
|
||||||
{
|
{
|
||||||
|
LogInfo(string_format("_trie.init(%s) start...", dictFilePath));
|
||||||
_trie.init(dictFilePath);
|
_trie.init(dictFilePath);
|
||||||
|
LogInfo("_trie.init end.");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Segment::destroy()
|
bool Segment::destroy()
|
||||||
@ -69,8 +71,7 @@ namespace CppJieba
|
|||||||
|
|
||||||
if(uniStr.empty())
|
if(uniStr.empty())
|
||||||
{
|
{
|
||||||
sprintf(logBuf, "utf8ToUnicode [%s] failed!", utfStr.c_str());
|
LogError(string_format("utf8ToUnicode [%s] failed!", utfStr.c_str()));
|
||||||
LogError(logBuf);
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return uniStr;
|
return uniStr;
|
||||||
@ -178,11 +179,6 @@ int main()
|
|||||||
|
|
||||||
vector<string> res;
|
vector<string> res;
|
||||||
string title = "我来到北京清华大学";
|
string title = "我来到北京清华大学";
|
||||||
/*segment.cutMM(title, res);
|
|
||||||
for(int i = 0; i < res.size(); i++)
|
|
||||||
{
|
|
||||||
cout<<res[i]<<endl;
|
|
||||||
}*/
|
|
||||||
segment.cutDAG(title, res);
|
segment.cutDAG(title, res);
|
||||||
for(int i = 0; i < res.size(); i++)
|
for(int i = 0; i < res.size(); i++)
|
||||||
{
|
{
|
||||||
|
4
Trie.cpp
4
Trie.cpp
@ -42,7 +42,6 @@ namespace CppJieba
|
|||||||
|
|
||||||
bool Trie::_buildTree(const char* const filePath)
|
bool Trie::_buildTree(const char* const filePath)
|
||||||
{
|
{
|
||||||
char msgBuf[bufSize];
|
|
||||||
if(NULL != _root)
|
if(NULL != _root)
|
||||||
{
|
{
|
||||||
LogError("already initted!");
|
LogError("already initted!");
|
||||||
@ -58,8 +57,7 @@ namespace CppJieba
|
|||||||
splitStr(line, vecBuf, " ");
|
splitStr(line, vecBuf, " ");
|
||||||
if(3 != vecBuf.size())
|
if(3 != vecBuf.size())
|
||||||
{
|
{
|
||||||
sprintf(msgBuf, "line[%s] illegal.", line.c_str());
|
LogError(string_format("line[%s] illegal.", line.c_str()));
|
||||||
LogError(msgBuf);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
string chWord = vecBuf[0];
|
string chWord = vecBuf[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user