[Zope] spellchecker

garry saddington garry at joydiv.fsnet.co.uk
Sun Oct 10 09:31:57 EDT 2004


On Sunday 10 October 2004 12:29, Tino Wildenhain wrote:
> 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
Thanks for your patience it is much appreciated.
regards
garry


More information about the Zope mailing list