mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
init TfIdfKeyWord.hpp
This commit is contained in:
parent
670c7e4a13
commit
f89cf00552
32
src/TfIdfKeyWord.hpp
Normal file
32
src/TfIdfKeyWord.hpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef CPPJIEBA_TFIDF_H
|
||||||
|
#define CPPJIEBA_TFIDF_H
|
||||||
|
|
||||||
|
#include "MPSegment.hpp"
|
||||||
|
|
||||||
|
namespace CppJieba
|
||||||
|
{
|
||||||
|
using namespace Limonp;
|
||||||
|
|
||||||
|
class TfIdfKeyWord
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
MPSegment _segment;
|
||||||
|
public:
|
||||||
|
TfIdfKeyWord(const char* dictFile): _segment(dictFile){};
|
||||||
|
~TfIdfKeyWord(){};
|
||||||
|
public:
|
||||||
|
bool init(){return _segment.init();};
|
||||||
|
bool dispose(){return _segment.dispose();};
|
||||||
|
public:
|
||||||
|
bool extract(const string& str, vector<string>& words, uint topN)
|
||||||
|
{
|
||||||
|
return _segment.cut(words);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user