mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
fix bug
This commit is contained in:
parent
d15c7dd75c
commit
35647189a6
@ -13,8 +13,8 @@ int main(int argc, char ** argv)
|
||||
}
|
||||
KeyWordExt ext;
|
||||
ext.init();
|
||||
|
||||
if(!ext.loadSegDict("../dicts/jieba.dict.utf8"))
|
||||
|
||||
if(!ext.loadSegDict("../dicts/jieba.dict.gbk"))
|
||||
{
|
||||
cerr<<"1"<<endl;
|
||||
return 1;
|
||||
@ -25,11 +25,14 @@ int main(int argc, char ** argv)
|
||||
while(getline(ifile, line))
|
||||
{
|
||||
res.clear();
|
||||
ext.extract(line, res, 20);
|
||||
cout<<line<<"\n"<<joinStr(res," ")<<endl;
|
||||
if(!line.empty())
|
||||
{
|
||||
ext.extract(line, res, 20);
|
||||
cout<<line<<"\n"<<joinStr(res," ")<<endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
ext.dispose();
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -154,6 +154,11 @@ namespace CppJieba
|
||||
|
||||
bool KeyWordExt::extract(const string& title, vector<string>& keywords, uint topN)
|
||||
{
|
||||
if(title.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
LogDebug(string_format("title:[%s]",title.c_str()));
|
||||
#endif
|
||||
|
@ -46,6 +46,10 @@ namespace CppJieba
|
||||
|
||||
bool Segment::cutDAG(const string& str, vector<string>& res)
|
||||
{
|
||||
if(str.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
res.clear();
|
||||
|
||||
bool retFlag;
|
||||
|
Loading…
x
Reference in New Issue
Block a user