Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
c63c1946
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c63c1946
编写于
11月 17, 2003
作者:
T
Teodor Sigaev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize. Improve ispell support for compound words. This work was sponsored by ABC Startsiden AS.
上级
6a04c571
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
706 addition
and
294 deletion
+706
-294
contrib/tsearch2/dict_ispell.c
contrib/tsearch2/dict_ispell.c
+6
-6
contrib/tsearch2/ispell/spell.c
contrib/tsearch2/ispell/spell.c
+629
-276
contrib/tsearch2/ispell/spell.h
contrib/tsearch2/ispell/spell.h
+71
-12
未找到文件。
contrib/tsearch2/dict_ispell.c
浏览文件 @
c63c1946
...
...
@@ -27,7 +27,7 @@ Datum spell_lexize(PG_FUNCTION_ARGS);
static
void
freeDictISpell
(
DictISpell
*
d
)
{
FreeIspell
(
&
(
d
->
obj
));
NIFree
(
&
(
d
->
obj
));
freestoplist
(
&
(
d
->
stoplist
));
free
(
d
);
}
...
...
@@ -71,7 +71,7 @@ spell_init(PG_FUNCTION_ARGS)
(
errcode
(
ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
),
errmsg
(
"dictionary already loaded"
)));
}
if
(
ImportDictionary
(
&
(
d
->
obj
),
pcfg
->
value
))
if
(
NI
ImportDictionary
(
&
(
d
->
obj
),
pcfg
->
value
))
{
freeDictISpell
(
d
);
ereport
(
ERROR
,
...
...
@@ -90,7 +90,7 @@ spell_init(PG_FUNCTION_ARGS)
(
errcode
(
ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
),
errmsg
(
"affixes already loaded"
)));
}
if
(
ImportAffixes
(
&
(
d
->
obj
),
pcfg
->
value
))
if
(
NI
ImportAffixes
(
&
(
d
->
obj
),
pcfg
->
value
))
{
freeDictISpell
(
d
);
ereport
(
ERROR
,
...
...
@@ -132,8 +132,8 @@ spell_init(PG_FUNCTION_ARGS)
if
(
affloaded
&&
dictloaded
)
{
SortDictionary
(
&
(
d
->
obj
));
SortAffixes
(
&
(
d
->
obj
));
NI
SortDictionary
(
&
(
d
->
obj
));
NI
SortAffixes
(
&
(
d
->
obj
));
}
else
if
(
!
affloaded
)
{
...
...
@@ -168,7 +168,7 @@ spell_lexize(PG_FUNCTION_ARGS)
res
=
palloc
(
sizeof
(
char
*
)
*
2
);
txt
=
pnstrdup
(
in
,
PG_GETARG_INT32
(
2
));
res
=
NormalizeWord
(
&
(
d
->
obj
),
txt
);
res
=
N
IN
ormalizeWord
(
&
(
d
->
obj
),
txt
);
pfree
(
txt
);
if
(
res
==
NULL
)
...
...
contrib/tsearch2/ispell/spell.c
浏览文件 @
c63c1946
此差异已折叠。
点击以展开。
contrib/tsearch2/ispell/spell.h
浏览文件 @
c63c1946
...
...
@@ -4,15 +4,43 @@
#include <sys/types.h>
#include <regex.h>
struct
SPNode
;
typedef
struct
{
u_int32_t
val:
8
,
isword:
1
,
compoundallow:
1
,
affix:
22
;
struct
SPNode
*
node
;
}
SPNodeData
;
typedef
struct
SPNode
{
u_int32_t
length
;
SPNodeData
data
[
1
];
}
SPNode
;
#define SPNHRDSZ (sizeof(u_int32_t))
typedef
struct
spell_struct
{
char
*
word
;
char
flag
[
10
];
union
{
char
flag
[
16
];
struct
{
int
affix
;
int
len
;
}
d
;
}
p
;
}
SPELL
;
typedef
struct
aff_struct
{
char
flag
;
char
flagflags
;
char
type
;
char
mask
[
33
];
char
find
[
16
];
...
...
@@ -22,35 +50,66 @@ typedef struct aff_struct
char
compile
;
}
AFFIX
;
#define FF_CROSSPRODUCT 0x01
#define FF_COMPOUNDWORD 0x02
#define FF_COMPOUNDONLYAFX 0x04
struct
AffixNode
;
typedef
struct
{
u_int32_t
val:
8
,
naff:
24
;
AFFIX
**
aff
;
struct
AffixNode
*
node
;
}
AffixNodeData
;
typedef
struct
AffixNode
{
u_int32_t
length
;
AffixNodeData
data
[
1
];
}
AffixNode
;
#define ANHRDSZ (sizeof(u_int32_t))
typedef
struct
Tree_struct
{
int
Left
[
256
],
Right
[
256
];
}
Tree_struct
;
typedef
struct
{
char
*
affix
;
int
len
;
}
CMPDAffix
;
typedef
struct
{
int
maffixes
;
int
naffixes
;
AFFIX
*
Affix
;
char
compoundcontrol
;
int
nspell
;
int
mspell
;
SPELL
*
Spell
;
Tree_struct
SpellTree
;
Tree_struct
PrefixTree
;
Tree_struct
SuffixTree
;
AffixNode
*
Suffix
;
AffixNode
*
Prefix
;
SPNode
*
Dictionary
;
char
**
AffixData
;
CMPDAffix
*
CompoundAffix
;
}
IspellDict
;
char
**
NormalizeWord
(
IspellDict
*
Conf
,
char
*
word
);
int
ImportAffixes
(
IspellDict
*
Conf
,
const
char
*
filename
);
int
ImportDictionary
(
IspellDict
*
Conf
,
const
char
*
filename
);
char
**
N
IN
ormalizeWord
(
IspellDict
*
Conf
,
char
*
word
);
int
NI
ImportAffixes
(
IspellDict
*
Conf
,
const
char
*
filename
);
int
NI
ImportDictionary
(
IspellDict
*
Conf
,
const
char
*
filename
);
int
AddSpell
(
IspellDict
*
Conf
,
const
char
*
word
,
const
char
*
flag
);
int
AddAffix
(
IspellDict
*
Conf
,
int
flag
,
const
char
*
mask
,
const
char
*
find
,
const
char
*
repl
,
int
type
);
void
SortDictionary
(
IspellDict
*
Conf
);
void
SortAffixes
(
IspellDict
*
Conf
);
void
FreeIspell
(
IspellDict
*
Conf
);
int
NI
AddSpell
(
IspellDict
*
Conf
,
const
char
*
word
,
const
char
*
flag
);
int
NIAddAffix
(
IspellDict
*
Conf
,
int
flag
,
char
flagflags
,
const
char
*
mask
,
const
char
*
find
,
const
char
*
repl
,
int
type
);
void
NI
SortDictionary
(
IspellDict
*
Conf
);
void
NI
SortAffixes
(
IspellDict
*
Conf
);
void
NIFree
(
IspellDict
*
Conf
);
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录