add Segment.cpp/h

This commit is contained in:
gwdwyy 2013-07-05 11:45:12 +08:00
parent 03dfe02b12
commit 22522b355c
2 changed files with 64 additions and 0 deletions

41
Segment.cpp Normal file
View 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
View 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