modify extract function

This commit is contained in:
gwdwyy 2013-07-12 15:56:58 +08:00
parent 21adc72793
commit 41a4dbdea4
2 changed files with 3 additions and 3 deletions

View File

@ -64,7 +64,7 @@ namespace CppJieba
return true; return true;
} }
bool Segment::extract(const string& utf8Str, vector<string>& keywords) bool Segment::extract(const string& utf8Str, vector<string>& keywords, uint topN)
{ {
LogInfo(utf8Str); LogInfo(utf8Str);
bool retFlag; bool retFlag;
@ -86,7 +86,7 @@ namespace CppJieba
} }
LogDebug(string_format("_filter res:[%s]", joinStr(tmp, ",").c_str())); LogDebug(string_format("_filter res:[%s]", joinStr(tmp, ",").c_str()));
retFlag = _extractTopN(tmp, keywords, 5); retFlag = _extractTopN(tmp, keywords, topN);
if(!retFlag) if(!retFlag)
{ {
LogError("_extractTopN failed."); LogError("_extractTopN failed.");

View File

@ -20,7 +20,7 @@ namespace CppJieba
bool destroy(); bool destroy();
public: public:
bool cutDAG(const string& chStr, vector<string>& res); 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 getUtf8WordWeight(const string& word);
double getUniWordWeight(const string& word); double getUniWordWeight(const string& word);