Spell checking from Python

by John on November 29, 2008

I needed to find a spell checker I could call from Python, so I did a Google search and ran across GNU aspell. I tried installing it but got contradictory warning messages: aspell not installed, aspell already installed, etc. Then I remembered what an awful time I’d had before when I’d tried to use aspell and gave up.

Next I tried Ryan Kelly’s PyEnchant and it worked like a charm. I downloaded the installer for Windows and ran it. Then I opened up a Python console and typed an example following the online tutorial.

>>> import enchant
>>> d = enchant.Dict("en_US")
>>> d.check("Potatoe")
False
>>> d.check("Potato")
True

It just works.

{ 3 comments… read them below or add one }

1

B Riley 11.29.08 at 20:54

In case you have never seen this, Peter Norvig has a wonderful essay on developing a spell checker in Python:
http://www.norvig.com/spell-correct.html

2

Dan Quayle 11.30.08 at 07:23

There seems to be a problem with that program getting things backward. I don’t think I would truste it.

– Dan Quayle

3

John 11.30.08 at 07:26

:-)

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>