Modify the dictionary on different platforms

Various results for the enchantment library (enchantment 1.6.6)

On MAC OSX 10.11.12 (El Capitan):

>>> import enchant >>> d = enchant.Dict("en_US") >>> d.suggest("prfomnc") ['performance', 'prominence', 'preform', 'perform'] 

On 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 "offering" 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 all the same results

+5
source share
1 answer

The enchant library is not a spell correction library. Instead, it is an aggregator that looks for an interface with many supported systems.

From the documentation:

Enchantment can have several loads at once. Enchant currently has 8 backend:

 Aspell/Pspell (intends to replace Ispell) Ispell (old as sin, could be interpreted as a defacto standard) MySpell/Hunspell (an OOo project, also used by Mozilla) Uspell (primarily Yiddish, Hebrew, and Eastern European languages - hosted in AbiWord CVS under the module "uspell") Hspell (Hebrew) Zemberek (Turkish) Voikko (Finnish) AppleSpell (Mac OSX) 

Pay attention to the last?

I suspect that without spending any energy to confirm this, you get different results, because your MacOS system and your Linux system have different spelling software, or maybe they have the same software, but, they may be in a different order in the search path used by enchant .

+1
source

Source: https://habr.com/ru/post/1242925/


All Articles