mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
modify extract function
This commit is contained in:
parent
21adc72793
commit
41a4dbdea4
@ -64,7 +64,7 @@ namespace CppJieba
|
||||
|
||||
return true;
|
||||
}
|
||||
bool Segment::extract(const string& utf8Str, vector<string>& keywords)
|
||||
bool Segment::extract(const string& utf8Str, vector<string>& keywords, uint topN)
|
||||
{
|
||||
LogInfo(utf8Str);
|
||||
bool retFlag;
|
||||
@ -86,7 +86,7 @@ namespace CppJieba
|
||||
}
|
||||
LogDebug(string_format("_filter res:[%s]", joinStr(tmp, ",").c_str()));
|
||||
|
||||
retFlag = _extractTopN(tmp, keywords, 5);
|
||||
retFlag = _extractTopN(tmp, keywords, topN);
|
||||
if(!retFlag)
|
||||
{
|
||||
LogError("_extractTopN failed.");
|
||||
|
@ -20,7 +20,7 @@ namespace CppJieba
|
||||
bool destroy();
|
||||
public:
|
||||
bool cutDAG(const string& chStr, vector<string>& res);
|
||||
bool extract(const string& utf8Str, vector<string>& keywords);
|
||||
bool extract(const string& utf8Str, vector<string>& keywords, uint topN);
|
||||
double getUtf8WordWeight(const string& word);
|
||||
double getUniWordWeight(const string& word);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user