Different results for enchant library (enchant 1.6.6)
In MAC OSX 10.11.12 (El Capitan):
>>> import enchant
>>> d = enchant.Dict("en_US")
>>> d.suggest("prfomnc")
['performance', 'prominence', 'preform', 'perform']
In Linux Ubuntu 14.04 LTS:
>>> import enchant
>>> d = enchant.Dict("en_US")
>>> d.suggest("prfomnc")
['princedom', 'preferment', 'preform']
Any ideas why I get different results and other alternatives in NLTK for "suggest" functionality?
MAC OS
>>> enchant.list_dicts()
[('de_DE', <Enchant: Myspell Provider>), ('en_AU', <Enchant: Myspell Provider>), ('en_GB', <Enchant: Myspell Provider>), ('en_US', <Enchant: Myspell Provider>), ('fr_FR', <Enchant: Myspell Provider>)]
Ubuntu
>>> enchant.list_dicts()
[('en', <Enchant: Aspell Provider>), ('en_CA', <Enchant: Aspell Provider>), ('en_GB', <Enchant: Aspell Provider>), ('en_US', <Enchant: Aspell Provider>), ('en_ZA', <Enchant: Myspell Provider>), ('en_AU', <Enchant: Myspell Provider>)]
In my Ubuntu tried:
>>> b = enchant.Broker()
>>> b.set_ordering("en_US","myspell,aspell")
>>> b.set_ordering("*","aspell,myspell")
>>> b.request_dict("en_US").provider
<Enchant: Myspell Provider>
>>> b.request_dict("en_GB").provider
<Enchant: Aspell Provider>
>>> d.suggest("prfomnc")
['princedom', 'preferment', 'preform']
But still same results
The
enchant
library is not a spell-correction library. Instead, it is an aggregator, searching for an interfacing with a variety of supported systems.From the documentation:
Notice the last one?
I suspect, without expending any energy to confirm it, that you're getting different results because your MacOS system and your Linux system have different spelling software installed, or perhaps they have the same software installed but maybe they are in a different order in the searchpath used by
enchant
.