How to use this feature? Is there a configuration option to choose an alternative backend?
The answer to that question is a bit complicated, so let’s take an example.
plugins and providers
On my machine, the enchant
library was built with the following plugins:
/usr/lib/enchant-2/enchant_aspell.so
/usr/lib/enchant-2/enchant_hspell.so
/usr/lib/enchant-2/enchant_hunspell.so
/usr/lib/enchant-2/enchant_voikko.so
Each plugin implements a provider. In this case, Enchant was built with
the aspell
and voikko
plugins, so it can use dictionaries coming from those
two providers.
the issue
Now let’s assume you have these packages installed:
aspell-en
: Aspell dictionary for English
aspell-fi
: Aspell dictionary for Finnish
voikko-fi
: Voikko dictionary for Finnish
Enchant has to decide which package to use when spellchecking a Finnish
document - and there are two possible answers here (aspell-fi
or voikko-fi
).
ordering
In order to solve this, Enchant uses a file named ordering that looks like this:
# /usr/share/enchant/enchant.ordering
*:hunspell,nuspell,aspell
fi:voikko,hunspell,nuspell,aspell
fi_FI:voikko,hunspell,nuspell,aspell
he:hspell,hunspell,nuspell
he_IL:hspell,hunspell,nuspell
tr:zemberek,nuspell
tr_TR:zemberek,nuspell
Since voikko
is the first provider listed on the fi
line, it will use voikko-fi
.
In short, it is Enchant’s job to determine which provider the most suited
for the requested language, not the end user. In that case it makes sense, since
voikko
is a provider dedicated to the Finnish language.
But what if you really want to use aspell-fi
?
forcing the aspell provider
Well, the first option is to use the set_ordering
method on the broker object:
>>> from enchant import Broker
>>> broker = Broker()
>>> broker.set_ordering("fi", "aspell,voikko")
>>> fi_dict = broker.request_dict("fi")
>>> fi_dict.provider.name
'aspell'
kak-spell
never uses the set_ordering
method on the broker object, so this won’t work
for kak-spell
.
But before implementing something like a kak_spell_ordering
option, I should point out there’s a much easier solution to the problem at hand: just remove the voikko-fi
package from your system!
conclusion
I hope this clarify things - for now I think that implementing kak_spell_ordering
is overkill, unless there’s something about your use case I’m missing.