forked from yanyiwu/gojieba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jieba.h
43 lines (33 loc) · 1.04 KB
/
jieba.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
39
40
41
42
43
#ifndef CJIEBA_JIEBA_H
#define CJIEBA_JIEBA_H
#include <stdlib.h>
#include "util.h"
typedef void* Jieba;
typedef struct {
size_t offset;
size_t len;
} Word;
typedef enum {
DefaultMode = 0,
SearchMode = 1,
} TokenizeMode;
Jieba NewJieba(const char* dict_path,
const char* hmm_path,
const char* user_dict,
const char* idf_path,
const char* stop_words_path);
void FreeJieba(Jieba);
char** Cut(Jieba handle, const char* sentence, int is_hmm_used);
char** CutAll(Jieba handle, const char* sentence);
char** CutForSearch(Jieba handle, const char* sentence, int is_hmm_used);
char** Tag(Jieba handle, const char* sentence);
void AddWord(Jieba handle, const char* word);
Word* Tokenize(Jieba x, const char* sentence, TokenizeMode mode, int is_hmm_used);
struct CWordWeight {
char* word;
double weight;
};
char** Extract(Jieba handle, const char* sentence, int top_k);
struct CWordWeight* ExtractWithWeight(Jieba handle, const char* sentence, int top_k);
void FreeWordWeights(struct CWordWeight* wws);
#endif // CJIEBA_JIEBA_H