Hie can anyone help me out with detailed process of downloading & importing an external library called PyEnchant, to check a spelling of word is valid english word or not
4 Answers
You have to install it with
pip install pyenchant
Simple usage Example from the docs:
import enchant
d = enchant.Dict("en_US")
d.check("Hello") # Returns True
d.check("Helo") # Returns False
For installing pip see: https://pip.pypa.io/en/latest/installing.html#install-pip
Comments
The official PyEnchant page asks these prerequisites before you install:
Prerequisites
To get PyEnchant up and running, you will need the following software installed:
Python 2.6 or later The enchant library, version 1.5.0 or later. For Windows users, the binary installers below include a pre-built copy of enchant. For Mac OSX users, the binary installers below include a pre-built copy of enchant.
For your convenience there's an exe which should be able to do the above - Download it.
If you want to install enchant first, and then pyenchant, then download enchant from here.
Pyenchant is on PyPi, so you should be able to
pip install pyenchant
If you don't have pip, then download get-pip.py and run python get-pip.py (this might require you to have admin privileges)
and then in your python prompt,
>>> import enchant
>>> help(enchant)
From the documentation:
>>> import enchant
>>> d = enchant.Dict("en_US")
>>> d.check("Hello")
True
>>> d.check("Helo")
False
>>> d.suggest("Helo")
['He lo', 'He-lo', 'Hello', 'Helot', 'Help', 'Halo', 'Hell', 'Held', 'Helm', 'Hero', "He'll"]
Comments
With Windows 10 (64 bit), Python 3.6:
First install pip:
- copy the text in this link https://bootstrap.pypa.io/get-pip.py and save it to a file in your preferred folder. Call the file: "get-pip.py"
- click on start --> type "cmd" --> right click --> open as administrator
cd C:\Users\yourpath\yourfolder\get-pip.py install- if a message appears, saying to upgrade:
python -m pip install --upgrade pip
Second:
- go to https://pypi.python.org/pypi/pyenchant/
- download
pyenchant-2.0.0-py2.py3.cp27.cp32.cp33.cp34.cp35.cp36.pp27.pp33.pp35-none-win32.whl3) from the command line opened as administrator:cd C:\Users\yourpath\yourfolder\ py -3.6 -m pip install pyenchant-2.0.0-py2.py3.cp27.cp32.cp33.cp34.cp35.cp36.pp27.pp33.pp35-none-win32.whl
Comments
Before you can install pyEnchant, you must install Enchant from here.
Then, and only then, run
pip install pyenchant
in your console to be able to use pyenchant in your python programs.