mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
add Segment.cpp/h
This commit is contained in:
parent
03dfe02b12
commit
22522b355c
41
Segment.cpp
Normal file
41
Segment.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include "Segment.h"
|
||||
|
||||
namespace CppJieba
|
||||
{
|
||||
Segment::Segment():_trie()
|
||||
{
|
||||
}
|
||||
|
||||
Segment::~Segment()
|
||||
{
|
||||
}
|
||||
|
||||
bool Segment::init(const char* const dictFilePath)
|
||||
{
|
||||
_trie.init(dictFilePath);
|
||||
}
|
||||
|
||||
bool Segment::destroy()
|
||||
{
|
||||
return _trie.destroy();
|
||||
}
|
||||
|
||||
bool Segment::cutRMM(const string& chStr, vector<string>& res)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef SEGMENT_UT
|
||||
using namespace CppJieba;
|
||||
|
||||
int main()
|
||||
{
|
||||
Segment segment;
|
||||
segment.init("dict.utf8");
|
||||
segment.destroy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
23
Segment.h
Normal file
23
Segment.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef SEGMENT_H
|
||||
#define SEGMENT_H
|
||||
|
||||
#include "Trie.h"
|
||||
|
||||
namespace CppJieba
|
||||
{
|
||||
class Segment
|
||||
{
|
||||
private:
|
||||
Trie _trie;
|
||||
public:
|
||||
Segment();
|
||||
~Segment();
|
||||
public:
|
||||
bool init(const char* const dictFilePath);
|
||||
bool destroy();
|
||||
public:
|
||||
bool cutRMM(const string& chStr, vector<string>& res);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user