mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-03-01 19:45:33 +08:00
Fix merge affixes for numeric ones
Some dictionaries have duplicated base words with different affix set, we just merge that sets into one set. But previously merging of sets of affixes was actually a concatenation of strings but it's wrong for numeric representation of affixes because such representation uses comma to separate affixes. Author: Artur Zakirov
This commit is contained in:
parent
a9eb6c83ef
commit
8829af47ef
@ -1465,6 +1465,12 @@ MergeAffix(IspellDict *Conf, int a1, int a2)
|
||||
{
|
||||
char **ptr;
|
||||
|
||||
/* Do not merge affix flags if one of affix flags is empty */
|
||||
if (*Conf->AffixData[a1] == '\0')
|
||||
return a2;
|
||||
else if (*Conf->AffixData[a2] == '\0')
|
||||
return a1;
|
||||
|
||||
while (Conf->nAffixData + 1 >= Conf->lenAffixData)
|
||||
{
|
||||
Conf->lenAffixData *= 2;
|
||||
@ -1473,10 +1479,20 @@ MergeAffix(IspellDict *Conf, int a1, int a2)
|
||||
}
|
||||
|
||||
ptr = Conf->AffixData + Conf->nAffixData;
|
||||
*ptr = cpalloc(strlen(Conf->AffixData[a1]) +
|
||||
strlen(Conf->AffixData[a2]) +
|
||||
1 /* space */ + 1 /* \0 */ );
|
||||
sprintf(*ptr, "%s %s", Conf->AffixData[a1], Conf->AffixData[a2]);
|
||||
if (Conf->flagMode == FM_NUM)
|
||||
{
|
||||
*ptr = cpalloc(strlen(Conf->AffixData[a1]) +
|
||||
strlen(Conf->AffixData[a2]) +
|
||||
1 /* comma */ + 1 /* \0 */ );
|
||||
sprintf(*ptr, "%s,%s", Conf->AffixData[a1], Conf->AffixData[a2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
*ptr = cpalloc(strlen(Conf->AffixData[a1]) +
|
||||
strlen(Conf->AffixData[a2]) +
|
||||
1 /* \0 */ );
|
||||
sprintf(*ptr, "%s%s", Conf->AffixData[a1], Conf->AffixData[a2]);
|
||||
}
|
||||
ptr++;
|
||||
*ptr = NULL;
|
||||
Conf->nAffixData++;
|
||||
|
Loading…
Reference in New Issue
Block a user