dziglo
dziglo

Reputation: 11

Using Prefixes and Suffixes in Hunspell

How can Hunspell take into account the incorrect combination of some prefixes and suffixes?

Let's say the aff file contains:

PFX P Y 2 PFX P 0 la PFX P 0 ma

SFX A Y 1 SFX A 0 zon

And in the dic file there is: adal/PA

So Hunspell will generate the following values: adal adalzon laadalzon laadal maadalzon maadal

But I need it to be incorrect for the word "adal" to simultaneously combine it with both a prefix and a suffix.

That is, it is correct: adal adalzon laadal maadal

Incorrect: laadalzon maadalzon

Please tell me. How can you make sure that incorrect options are excluded.

Upvotes: 1

Views: 114

Answers (2)

shantanuo
shantanuo

Reputation: 32224

Just change "Y" to "N" in the declaration line.

For e.g. if this your affix file:

PFX P Y 2
PFX P 0 la
PFX P 0 ma
        
SFX S Y 1
SFX S 0 zon

The new affix file will look like this...

PFX P N 2
PFX P 0 la
PFX P 0 ma
        
SFX S N 1
SFX S 0 zon

"Y" allows Cross product (permission to combine prefixes and suffixes)

Upvotes: 0

Siddharth Singh
Siddharth Singh

Reputation: 160

You can use Hunspell's FLAG and CONDITION mechanisms. Here P is for prefix and S for suffix.

FLAG P 1
FLAG S 1
        
PFX P Y 2
PFX P 0 la
PFX P 0 ma
        
SFX S Y 1
SFX S 0 zon
        
CONDITION
P+S

Upvotes: 0

Related Questions