1 From 42807f970ac2d65f0d13a7c57eb454b210e92240 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20N=C3=A9meth?=
3 <laszlo.nemeth@collabora.com>
4 Date: Mon, 12 Oct 2015 08:43:12 +0200
5 Subject: [PATCH] fix compound handling for new Hungarian orthography
7 The frequent cases of this compound limitation are handled by
8 the extended dictionary, but not these ones with both derivative
9 and inflectional suffixes.
11 src/hunspell/affixmgr.cxx | 19 +++++++++++++++----
12 src/hunspell/affixmgr.hxx | 1 +
13 2 files changed, 16 insertions(+), 4 deletions(-)
15 diff --git a/src/hunspell/affixmgr.cxx b/src/hunspell/affixmgr.cxx
16 index 0992e6e..0950425 100644
17 --- misc/hunspell-1.3.3/src/hunspell/affixmgr.cxx
18 +++ misc/build/hunspell-1.3.3/src/hunspell/affixmgr.cxx
19 @@ -139,8 +139,9 @@ AffixMgr::AffixMgr(const char * affpath, HashMgr** ptr, int * md, const char * k
20 cpdvowels=NULL; // vowels (for calculating of Hungarian compounding limit, O(n) search! XXX)
21 cpdvowels_utf16=NULL; // vowels for UTF-8 encoding (bsearch instead of O(n) search)
22 cpdvowels_utf16_len=0; // vowels
23 - pfxappnd=NULL; // previous prefix for counting the syllables of prefix BUG
24 - sfxappnd=NULL; // previous suffix for counting a special syllables BUG
25 + pfxappnd=NULL; // previous prefix for counting syllables of the prefix BUG
26 + sfxappnd=NULL; // previous suffix for counting syllables of the suffix BUG
27 + sfxextra=0; // modifier for syllable count of sfxappnd BUG
28 cpdsyllablenum=NULL; // syllable count incrementing flag
29 checknum=0; // checking numbers, and word with numbers
30 wordchars=NULL; // letters + spec. word characters
31 @@ -1201,6 +1202,7 @@ struct hentry * AffixMgr::prefix_check(const char * word, int len, char in_compo
37 // first handle the special case of 0 length prefixes
38 PfxEntry * pe = pStart[0];
39 @@ -1261,6 +1263,7 @@ struct hentry * AffixMgr::prefix_check_twosfx(const char * word, int len,
45 // first handle the special case of 0 length prefixes
46 PfxEntry * pe = pStart[0];
47 @@ -1302,6 +1305,7 @@ char * AffixMgr::prefix_check_morph(const char * word, int len, char in_compound
53 // first handle the special case of 0 length prefixes
54 PfxEntry * pe = pStart[0];
55 @@ -1353,6 +1357,7 @@ char * AffixMgr::prefix_check_twosfx_morph(const char * word, int len,
61 // first handle the special case of 0 length prefixes
62 PfxEntry * pe = pStart[0];
63 @@ -1993,7 +1998,7 @@ struct hentry * AffixMgr::compound_check(const char * word, int len,
64 // XXX only second suffix (inflections, not derivations)
66 char * tmp = myrevstrdup(sfxappnd);
67 - numsyllable -= get_syllable(tmp, strlen(tmp));
68 + numsyllable -= get_syllable(tmp, strlen(tmp)) + sfxextra;
72 @@ -2512,7 +2517,7 @@ int AffixMgr::compound_check_morph(const char * word, int len,
73 // XXX only second suffix (inflections, not derivations)
75 char * tmp = myrevstrdup(sfxappnd);
76 - numsyllable -= get_syllable(tmp, strlen(tmp));
77 + numsyllable -= get_syllable(tmp, strlen(tmp)) + sfxextra;
81 @@ -2696,6 +2701,12 @@ struct hentry * AffixMgr::suffix_check (const char * word, int len,
82 sfx=sptr; // BUG: sfx not stateless
83 sfxflag = sptr->getFlag(); // BUG: sfxflag not stateless
84 if (!sptr->getCont()) sfxappnd=sptr->getKey(); // BUG: sfxappnd not stateless
85 +// LANG_hu section: spec. Hungarian rule
86 + else if (langnum == LANG_hu && sptr->getKeyLen() && sptr->getKey()[0] == 'i' &&
87 + sptr->getKey()[1] != 'y' && sptr->getKey()[1] != 't') {
90 +// END of LANG_hu section
94 diff --git a/src/hunspell/affixmgr.hxx b/src/hunspell/affixmgr.hxx
95 index 2679b7f..8839814 100644
96 --- misc/hunspell-1.3.3/src/hunspell/affixmgr.hxx
97 +++ misc/build/hunspell-1.3.3/src/hunspell/affixmgr.hxx
98 @@ -155,6 +155,7 @@ class LIBHUNSPELL_DLL_EXPORTED AffixMgr
99 char * cpdsyllablenum;
100 const char * pfxappnd; // BUG: not stateless
101 const char * sfxappnd; // BUG: not stateless
102 + int sfxextra; // BUG: not stateless
103 FLAG sfxflag; // BUG: not stateless
104 char * derived; // BUG: not stateless
105 SfxEntry * sfx; // BUG: not stateless