-
Notifications
You must be signed in to change notification settings - Fork 2
/
wordbase.h
38 lines (28 loc) · 901 Bytes
/
wordbase.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef _WORDBASE_H
#define _WORDBASE_H
#include "nodepool.h"
#include <fstream>
//add by freeeyes
//分词算法
class CWordBase
{
public:
CWordBase();
~CWordBase();
size_t Get_Mem_Size(int nPoolSize);
bool Init(const char* pDictFile, int nPoolSize, char* pData);
bool Load(int nPoolSize, char* pData);
void Close();
int Add_Word(const char* pWord);
int Cut_Word(const char* pSentence, vector<string>& vecWord);
int Cut(const char* pSentence, vector<string>& vecWord);
private:
_RuneLinkNode* Set_HashMap_Word_Tree(_RuneLinkNode* pRuneNode, _Rune* pRune, int nLayer);
void DisplayTempNodeList(_RuneLinkNode* pRuneNode, int nLayer);
_RuneLinkNode* Find(_Rune* pRune, _RuneLinkNode* pRuneLinkNode);
private:
_RuneLinkNode* m_pWordRoot;
CNodePool m_objNodePool;
int* m_emType; //当前字典字符集,(UTF8或者GBK)
};
#endif