提交 f4ceed6c 编写于 作者: T Teodor Sigaev

Improve support of Hunspell

- allow to use non-ascii characters as affix flag. Non-numeric affix flags now
  are stored as string instead of numeric value of character.
- allow to use 0 as affix flag in numeric encoded affixes

That adds support for arabian, hungarian, turkish and
brazilian portuguese languages.

Author: Artur Zakirov with heavy editorization by me
上级 0218e8b3
此差异已折叠。
......@@ -45,7 +45,7 @@ typedef struct
#define FF_COMPOUNDLAST 0x08
#define FF_COMPOUNDFLAG ( FF_COMPOUNDBEGIN | FF_COMPOUNDMIDDLE | \
FF_COMPOUNDLAST )
#define FF_DICTFLAGMASK 0x0f
#define FF_COMPOUNDFLAGMASK 0x0f
typedef struct SPNode
{
......@@ -86,7 +86,7 @@ typedef struct spell_struct
*/
typedef struct aff_struct
{
uint32 flag:16;
char *flag;
/* FF_SUFFIX or FF_PREFIX */
uint32 type:1,
flagflags:7,
......@@ -146,14 +146,34 @@ typedef struct
bool issuffix;
} CMPDAffix;
/*
* Type of encoding affix flags in Hunspel dictionaries
*/
typedef enum
{
FM_CHAR,
FM_LONG,
FM_NUM
FM_CHAR, /* one character (like ispell) */
FM_LONG, /* two characters */
FM_NUM /* number, >= 0 and < 65536 */
} FlagMode;
#define FLAGCHAR_MAXSIZE (1 << 8)
/*
* Structure to store Hunspell options. Flag representation depends on flag
* type. These flags are about support of compound words.
*/
typedef struct CompoundAffixFlag
{
union
{
/* Flag name if flagMode is FM_CHAR or FM_LONG */
char *s;
/* Flag name if flagMode is FM_NUM */
uint32 i;
} flag;
/* we don't have a bsearch_arg version, so, copy FlagMode */
FlagMode flagMode;
uint32 value;
} CompoundAffixFlag;
#define FLAGNUM_MAXSIZE (1 << 16)
typedef struct
......@@ -174,10 +194,20 @@ typedef struct
CMPDAffix *CompoundAffix;
unsigned char flagval[FLAGNUM_MAXSIZE];
bool usecompound;
FlagMode flagMode;
/*
* All follow fields are actually needed only for initialization
*/
/* Array of Hunspell options in affix file */
CompoundAffixFlag *CompoundAffixFlags;
/* number of entries in CompoundAffixFlags array */
int nCompoundAffixFlag;
/* allocated length of CompoundAffixFlags array */
int mCompoundAffixFlag;
/*
* Remaining fields are only used during dictionary construction; they are
* set up by NIStartBuild and cleared by NIFinishBuild.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册