From 41a4dbdea45ce54781e918443325970a91c36694 Mon Sep 17 00:00:00 2001 From: gwdwyy Date: Fri, 12 Jul 2013 15:56:58 +0800 Subject: [PATCH] modify extract function --- src/Segment.cpp | 4 ++-- src/Segment.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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);