Spell checking and Python

G

Gilles Lenfant

Hi pythonists,

Any experience or pointer on using a spell checker (aspell, ispell ?) with a
Python app ?

Many thanks by advance
 
D

Dave Kuhlman

Gilles said:
Hi pythonists,

Any experience or pointer on using a spell checker (aspell, ispell
?) with a Python app ?

Many thanks by advance

Here is one way for UNIX/Linux running with X Windows:

def check(content):
file = open('ispell.tmp', 'w')
file.write(content)
file.close()
os.system('xterm -e ispell ispell.tmp')
file = open('ispell.tmp', 'r')
content = file.read()
file.close()
return content


You might want to use the tempfile module in the Python standard
library to create the temporary file, though.

Dave
 
G

Gilles Lenfant

Gilles Lenfant said:
Hi pythonists,

Any experience or pointer on using a spell checker (aspell, ispell ?) with a
Python app ?

Many thanks by advance


And many thanks to all afterwards...
 
K

Ken Godee

Jarek said:
Maybe myspell-python?

http://www.zgoda.biz/dnld/myspell-python-1.0-minimal.tar.gz

This is repackaged original library by Karl W. MacMillan. I finally
found a maitainer for this piece of code and I hope it will be actively
developed.

I recently (july) wrote a small spell check program using
myspell-python and thought it was far better than anything out
there and then it seemed to just drop off the face of the planet.
Where do you think it's going to be maintained so I can book mark it?
 
W

William Trenker

Jarek said:
Maybe myspell-python?

http://www.zgoda.biz/dnld/myspell-python-1.0-minimal.tar.gz

This is repackaged original library by Karl W. MacMillan. I finally
found a maitainer for this piece of code and I hope it will be actively
developed.

Might want to apply the following patch to __init__.py so that the dictionary files are located relative to the installation directory. When I first tried running myspell-python (Linux Python 2.3.2) I got a traceback -- the dictionary path was wrong compared with where setup.py actually installed the dictionaries.

After the fix, myspell-python worked very well. The list of suggested spellings for a given word is quite good.

Bill

--- __init__.py-original Wed Jun 11 13:41:23 2003
+++ __init__.py Thu Dec 18 13:18:24 2003
@@ -39,7 +39,7 @@
# break on other platforms.
self.dicts_path = sys.prefix + "/myspell-dicts/"
if sys.platform != 'win32':
- self.dicts_path = "/usr/share/myspell-dicts/"
+ self.dicts_path = sys.prefix + "/share/myspell-dicts/"
core.MySpellBase.__init__(self, self.dicts_path + "en_US.aff",
self.dicts_path + "en_US.dic")
 
J

Jarek Zgoda

William Trenker said:
Might want to apply the following patch to __init__.py so that the
dictionary files are located relative to the installation directory.
When I first tried running myspell-python (Linux Python 2.3.2) I got a
traceback -- the dictionary path was wrong compared with where
setup.py actually installed the dictionaries.

After the fix, myspell-python worked very well. The list of suggested
spellings for a given word is quite good.

Of course, all pathes, fixes and suggestions are welcome. I hope that
this piece of code finally find it's safe harbor at Savannah or SF. I
think that other people also find it worth using.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top