-
Notifications
You must be signed in to change notification settings - Fork 303
/
jieba.h
45 lines (35 loc) · 1.16 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
44
45
#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);
void AddWordEx(Jieba handle, const char* word, int freq, const char* tag);
void RemoveWord(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