1

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?

MauroT
  • 320
  • 2
  • 12

1 Answers1

1

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.

Marijn
  • 1,640
  • 14
  • 24
  • thank you! removing ``` COMPOUNDRULE 1 COMPOUNDRULE AC ``` gives one derivation only – MauroT May 12 '23 at 10:29
  • 1
    @MauroT If you want to convert multiple COMPOUNDRULEs to BEGIN/END then a simple solution may be to add a new tag: set a single `COMPOUNDEND E` and tag all `C` and `D` words and suffixes with `E` as well (i.e., `c/CE`, `d/DE`). – Marijn May 12 '23 at 10:46