aboutsummaryrefslogtreecommitdiff
path: root/contrib/tsearch2/ispell/spell.h
blob: baf5052f02689ea6307e85d56522061dc5b848dd (plain)
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
#ifndef __SPELL_H__
#define __SPELL_H__

#include <sys/types.h>
#include <regex.h>

typedef struct spell_struct
{
	char	   *word;
	char		flag[10];
}	SPELL;

typedef struct aff_struct
{
	char		flag;
	char		type;
	char		mask[33];
	char		find[16];
	char		repl[16];
	regex_t		reg;
	size_t		replen;
	char		compile;
}	AFFIX;

typedef struct Tree_struct
{
	int			Left[256],
				Right[256];
}	Tree_struct;

typedef struct
{
	int			maffixes;
	int			naffixes;
	AFFIX	   *Affix;

	int			nspell;
	int			mspell;
	SPELL	   *Spell;
	Tree_struct SpellTree;
	Tree_struct PrefixTree;
	Tree_struct SuffixTree;

}	IspellDict;

char	  **NormalizeWord(IspellDict * Conf, char *word);
int			ImportAffixes(IspellDict * Conf, const char *filename);
int			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);

#endif