diff --git a/src/Segment.cpp b/src/Segment.cpp index 5a38017..2c3b666 100644 --- a/src/Segment.cpp +++ b/src/Segment.cpp @@ -64,7 +64,7 @@ namespace CppJieba return true; } - bool Segment::extract(const string& utf8Str, vector& keywords) + bool Segment::extract(const string& utf8Str, vector& 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."); diff --git a/src/Segment.h b/src/Segment.h index 7a74bb7..7f73b77 100644 --- a/src/Segment.h +++ b/src/Segment.h @@ -20,7 +20,7 @@ namespace CppJieba bool destroy(); public: bool cutDAG(const string& chStr, vector& res); - bool extract(const string& utf8Str, vector& keywords); + bool extract(const string& utf8Str, vector& keywords, uint topN); double getUtf8WordWeight(const string& word); double getUniWordWeight(const string& word);