Questions tagged [enchant]

Enchant is a wrapper library for various spellchecking back-ends like Aspell or MySpell. It's part of the AbiWord project.

Enchant (libenchant) provides a uniform abstraction layer for multiple common spell-checking libraries.

The intent is to provide plug-in spellchecking capabilities to word processors and text editors by bridging the gap to spellcheckers that are already installed on a system.

The library is written in C/C++ and provides C/C++ bindings natively. There also are 3rd-party bindings for other programming languages, for example for Python, PHP, Ruby.

The public API of the Enchant library:

  • enchant_broker_describe — Enumerates the Enchant providers
  • enchant_broker_dict_exists — Whether a dictionary exists or not. Using non-empty tag
  • enchant_broker_free_dict — Free a dictionary resource
  • enchant_broker_free — Free the broker resource and its dictionaries
  • enchant_broker_get_error — Returns the last error of the broker
  • enchant_broker_init — create a new broker object capable of requesting
  • enchant_broker_list_dicts — Returns a list of available dictionaries
  • enchant_broker_request_dict — create a new dictionary using a tag
  • enchant_broker_request_pwl_dict — creates a dictionary using a PWL file
  • enchant_broker_set_ordering — Declares a preference of dictionaries to use for the language
  • enchant_dict_add_to_personal — add a word to personal word list
  • enchant_dict_add_to_session — add 'word' to this spell-checking session
  • enchant_dict_check — Check whether a word is correctly spelled or not
  • enchant_dict_describe — Describes an individual dictionary
  • enchant_dict_get_error — Returns the last error of the current spelling-session
  • enchant_dict_is_in_session — whether or not 'word' exists in this spelling-session
  • enchant_dict_quick_check — Check the word is correctly spelled and provide suggestions
  • enchant_dict_store_replacement — Add a correction for a word
  • enchant_dict_suggest — Will return a list of values if any of those pre-conditions are not met

Also see:

52 questions
25
votes
9 answers

ImportError: The 'enchant' C library was not found. Please install it via your OS package manager, or use a pre-built binary wheel from PyPI

The question is why I see the error message in the title when trying to import enchant. I am using Win64.
1man
  • 5,216
  • 7
  • 42
  • 56
8
votes
3 answers

Is it possible to pass multiple dictionary in enchant?

Is there any way I can use multiple dictionary in enchant. This is what I do, import enchant d = enchant.Dict("en_US") d.check("materialise") >> False But if I use enchant.Dict("en_UK"), I will get True. What is the best way to combine multiple…
Mass17
  • 1,555
  • 2
  • 14
  • 29
5
votes
1 answer

Using Pyenchant on AWS Lambda, can load package but not provider dictionaries, have compiled from source on EC2 and extracted .so files

I am trying to use the Python spellchecking library Pyenchant in a Lambda function on AWS. Pyenchant is a wrapper for the C libenchant library which in turn relies on word dictionaries from providers such as Aspell. In my python code running on…
dataHead
  • 61
  • 4
5
votes
1 answer

Enchant dictionary across different platforms

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: >>>…
gogasca
  • 9,283
  • 6
  • 80
  • 125
4
votes
3 answers

python spell corrector using ntlk

I am trying to write a spell corrector in python for a corpus of tweets i have (I am new to python and nltk). The tweets are in xml format and are tokenised. I have tried using the enchant.checker SpellingCorrector but seem to be getting a bug with…
user3361260
  • 41
  • 1
  • 3
3
votes
0 answers

enchant.errors.DictNotFoundError: Dictionary for language 'en_US' could not be found

I started creating a word game for fun but I ran into an error after finishing the game with the enchant library having errors. Every time I click enter it says en_US could not be found. enchant.errors.DictNotFoundError: Dictionary for language…
3
votes
1 answer

pyenchant error "DictNotFoundError: Dictionary for language 'en_US' could not be found"

I am running Python 3.6 in Spyder/Anaconda, I am trying to use enchant. I installed pyenchant using pip install pyenchant I also installed aspell using sudo apt-get install aspell-en I am executing in Python: import enchant print("The dict is",…
2
votes
2 answers

PHP 8 - Enchant not working - Broker returns an empty array

I am using PHP 8 on Xampp (Windows) Have added extension=php_enchant.dll to php.ini php directory added to windows PATH copied libenchant_hunspell.dll / libenchant_ispell.dll / libenchant_myspell.dll to [php]/lib/enchant moved *.dic & *.aff to…
iceman2894
  • 67
  • 1
  • 9
2
votes
0 answers

How can I apply the spell checker function to a large data set?

I have a spell check function( Peter Novig's spell correction) that works on small data frames but for data frames with 5000 words it takes a long time to run and I stop the program. Does anyone have a solution? #correct spelling import enchant from…
saba kjh
  • 43
  • 6
2
votes
0 answers

Call to undefined function enchant_broker_init()

I am trying to implement the tinyMCE spellchecker plugin and I have encountered a problem with enabling PHPs enchant module. The following code $enchant = enchant_broker_init(); print_r($enchant); Returns the following error Fatal error: Call to…
Tom
  • 12,776
  • 48
  • 145
  • 240
1
vote
1 answer

Enchant doesn't seem to be reading `enchant.ordering`

I have installed enchant on my macbook. I would like to only use AppleSpell for all languages and have therefore created the file ~/.config/enchant/enchant.ordering which looks like this -> > cat ~/.config/enchant/enchant.ordering *:AppleSpell Yet…
Fergie
  • 5,933
  • 7
  • 38
  • 42
1
vote
1 answer

why i'm getting AttributeError when using 'enchant.DictWithPWL()' from 'enchant' module?

I'm using enchant module. It has an attribute DictWithPWL to add personal word list to existing dictionary that is pre-defined. But i'm getting below error: def dictionary_words_finder(word_lst): meaningful_word = [] # creating a dictionary…
code-switch
  • 11
  • 1
  • 5
1
vote
0 answers

pyenchant / pylint cannot open dictionary files that have unicode paths

I want to use pylint on windows with spelling. I installed it like this pip install pylint[spelling]. And as I went and tried using it like this: pylint --disable all --enable spelling --spelling-dict en_US . I expected it to check the my spelling…
1
vote
0 answers

how to add dictionary to PyEnchant on windows

I'm using PyEnchant for the first time, I want to check if a word is in french or not import enchant d = enchant.Dict('fr_FR') d.check("Hello") # False but I'm having this error DictNotFoundError so I have to add fr_FR to the list of languages I…
asma bzd
  • 11
  • 3
1
vote
0 answers

ImportError: The 'enchant' C library was not found and maybe needs to be installed

I am trying to create a distroless container using gcr.io./distroless/python3-debian10 using base image as debian:buster-slim I've installed enchant in python virtual environment of the base image, then I've copied virtual environment to the…
1
2 3 4