COMPOUNDRULE inside SFX

49 Views Asked by At

I don't understand why my example doesn't work (maybe it's my mistake?)

I have this aff file

FULLSTRIP

COMPOUNDMIN 1

COMPOUNDRULE 1
COMPOUNDRULE AC

SFX B Y 1
SFX B a b/A a

This dic file

2
a/AB
c/C

And my tests are

ac
bc

The result by running analyze is

> ac
analyze(ac) =  pa:a st:a pa:c st:c
stem(ac) = ac
> bc
Unknown word.

While I expected bc to be recognized as analyze(bc) = pa:b st:b pa:c st:c, or something like that. Where am I doing wrong?

1

There are 1 best solutions below

2
On BEST ANSWER

To allow an affix within a compound you need to set one of the COMPOUNDFLAG flags on the affix rule. However, this does not seem to be compatible with COMPOUNDRULE. From the man page:

Note III: COMPOUNDRULE flags work completely separately from the compounding mechanisms using COMPOUNDFLAG, COMPOUNDBEGIN, etc. compound flags. (Use these flags on different entries for words).

However, since the rule in the question is simple you can substitute it with regular COMPOUNDBEGIN/MIDDLE/END flags.

For the affix permission COMPOUNDPERMITFLAG is a good candidate:

COMPOUNDPERMITFLAG flag
Prefixes are allowed at the beginning of compounds, suffixes are allowed at the end of compounds by default. Affixes with COMPOUNDPERMITFLAG may be inside of compounds.

Code:

FULLSTRIP

COMPOUNDMIN 1

COMPOUNDRULE 1
COMPOUNDRULE AC

COMPOUNDPERMITFLAG A
COMPOUNDBEGIN A
COMPOUNDEND C

SFX B Y 1
SFX B a b/A a

Example run:

$ hunspell -m -d custom_dictionary
ac
ac  pa:a st:a pa:c
ac  pa:a st:a pa:c st:c

bc
bc  pa:b st:a fl:B pa:c

Note that ac now has an extra derivation using the BEGIN/END pair.