[Zope] spellchecker
Tino Wildenhain
tino at wildenhain.de
Sun Oct 10 07:29:33 EDT 2004
Hi,
Am So, den 10.10.2004 schrieb garry saddington um 11:43:
...
> > Well. You could at least provide the URL to the product you are talking
> > about. Have you tried to contact the author?
> http://zope.org/Members/noa/folder_contents
> I can't find out how to contact the author that is why I have asked on the
> list.
This looks neither released nor maintained :-)
And from unpacking the archive you find:
0 bytes readme.txt
*.pyc files which you should remove anyway
Im especially faszinated by the line:
ispell = os.popen("echo " + word + " | ispell -a")
which promises exceptionally performance ;)
(It might even open security holes if the word
split has flaws)
> I have textareas that take input from users and I want them to be able to
> spell check their input.
> regards
> garry
In the simplest form I'd use an external method
like this:
import os
spellcheck(self,checktext=""):
spellin,spellout=os.popen2("ispell -a","rw")
spellout.readline() # read away banner
output=[]
for word in checktext.split():
spellin.write(word+"\n")
spellin.flush()
output.append((word,spellout.readline().strip()))
spellin.close()
spellout.close()
return output
which takes a plain text as input and responds with list
of tuples with the word and ispells answer which
you can format for output using a python script.
Sure this is a first shot and can be improved in many
ways (word-split, buffer management etc.)
Regards
Tino
More information about the Zope
mailing list