forked from jaiminpan/pg_jieba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pg_jieba.sql
91 lines (74 loc) · 3.26 KB
/
pg_jieba.sql
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
CREATE FUNCTION jieba_start(internal, integer)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
CREATE FUNCTION jieba_query_start(internal, integer)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
CREATE FUNCTION jieba_mp_start(internal, integer)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
CREATE FUNCTION jieba_hmm_start(internal, integer)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
CREATE FUNCTION jieba_gettoken(internal, internal, internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
CREATE FUNCTION jieba_end(internal)
RETURNS void
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
CREATE FUNCTION jieba_lextype(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
CREATE FUNCTION jieba_reload_dict()
RETURNS void
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
CREATE TEXT SEARCH PARSER jieba (
START = jieba_start,
GETTOKEN = jieba_gettoken,
END = jieba_end,
LEXTYPES = jieba_lextype,
HEADLINE = pg_catalog.prsd_headline
);
CREATE TEXT SEARCH PARSER jiebaqry (
START = jieba_query_start,
GETTOKEN = jieba_gettoken,
END = jieba_end,
LEXTYPES = jieba_lextype,
HEADLINE = pg_catalog.prsd_headline
);
CREATE TEXT SEARCH PARSER jiebamp (
START = jieba_mp_start,
GETTOKEN = jieba_gettoken,
END = jieba_end,
LEXTYPES = jieba_lextype,
HEADLINE = pg_catalog.prsd_headline
);
CREATE TEXT SEARCH PARSER jiebahmm (
START = jieba_hmm_start,
GETTOKEN = jieba_gettoken,
END = jieba_end,
LEXTYPES = jieba_lextype,
HEADLINE = pg_catalog.prsd_headline
);
CREATE TEXT SEARCH CONFIGURATION jiebacfg (PARSER = jieba);
COMMENT ON TEXT SEARCH CONFIGURATION jiebacfg IS 'Mix segmentation configuration for jieba';
CREATE TEXT SEARCH CONFIGURATION jiebaqry (PARSER = jiebaqry);
COMMENT ON TEXT SEARCH CONFIGURATION jiebaqry IS 'Query segmentation configuration for jieba';
CREATE TEXT SEARCH CONFIGURATION jiebamp (PARSER = jiebamp);
COMMENT ON TEXT SEARCH CONFIGURATION jiebamp IS 'MP segmentation configuration for jieba';
CREATE TEXT SEARCH CONFIGURATION jiebahmm (PARSER = jiebahmm);
COMMENT ON TEXT SEARCH CONFIGURATION jiebahmm IS 'Hmm segmentation configuration for jieba';
CREATE TEXT SEARCH DICTIONARY jieba_stem (TEMPLATE=simple, stopwords = 'jieba');
COMMENT ON TEXT SEARCH DICTIONARY jieba_stem IS 'jieba dictionary: lower case and check for stopword which including Unicode symbols that are mainly Chinese characters and punctuations';
ALTER TEXT SEARCH CONFIGURATION jiebacfg ADD MAPPING FOR eng,nz,n,m,i,l,d,s,t,mq,nr,j,a,r,b,f,nrt,v,z,ns,q,vn,c,nt,u,o,zg,nrfg,df,p,g,y,ad,vg,ng,x,ul,k,ag,dg,rr,rg,an,vq,e,uv,tg,mg,ud,vi,vd,uj,uz,h,ug,rz WITH jieba_stem;
ALTER TEXT SEARCH CONFIGURATION jiebaqry ADD MAPPING FOR eng,nz,n,m,i,l,d,s,t,mq,nr,j,a,r,b,f,nrt,v,z,ns,q,vn,c,nt,u,o,zg,nrfg,df,p,g,y,ad,vg,ng,x,ul,k,ag,dg,rr,rg,an,vq,e,uv,tg,mg,ud,vi,vd,uj,uz,h,ug,rz WITH jieba_stem;
ALTER TEXT SEARCH CONFIGURATION jiebamp ADD MAPPING FOR eng,nz,n,m,i,l,d,s,t,mq,nr,j,a,r,b,f,nrt,v,z,ns,q,vn,c,nt,u,o,zg,nrfg,df,p,g,y,ad,vg,ng,x,ul,k,ag,dg,rr,rg,an,vq,e,uv,tg,mg,ud,vi,vd,uj,uz,h,ug,rz WITH jieba_stem;
ALTER TEXT SEARCH CONFIGURATION jiebahmm ADD MAPPING FOR eng,nz,n,m,i,l,d,s,t,mq,nr,j,a,r,b,f,nrt,v,z,ns,q,vn,c,nt,u,o,zg,nrfg,df,p,g,y,ad,vg,ng,x,ul,k,ag,dg,rr,rg,an,vq,e,uv,tg,mg,ud,vi,vd,uj,uz,h,ug,rz WITH jieba_stem;