grammar & spell check
aleaxit at yahoo.com
Fri Dec 22 12:24:57 CET 2000
"Satheesh Babu" <vsbabu at erols.com> wrote in message
news:91u20g$pl3$1 at bob.news.rcn.net...
> Is there any suggestions on what services/software I can use
> to do grammar/spell check? for English language.
> 1. given a text string, it should do the checks and return
> errors/suggestions report
> 2. Should be able to interface from Python
> 3. Preferably should work from Win32 systems
> (that gives an idea, can't I use MS Word's functions for this?)
Of course, if you can count on Word being present on
your target machine; Python, with win32all (already
present in the ActiveState distribution), is an excellent
For example, here's a spell-check program in Python:
msword = win32com.client.Dispatch("Word.Application")
string = "Here is some texxt with a coupple of problems"
for word in string.split():
print "!%s! OK!" % word
print "?%s? ->"%word,
suggestions = msword.GetSpellingSuggestions(word)
for suggest in suggestions:
?texxt? -> text texts
?coupple? -> couple couplet coupler coupled couples
You'll need Word's online docs for VBA to learn all the
details about spell-checking and grammar-checking.
For a cross-platform and free solution, I would expect
you could wring something similar out of StarOffice 5.2,
but unfortunately I wouldn't know where to start to
get cross-platform interfacing of Python with SO 5.2
(on Windows, specifically, they probably expose some
COM object model -- but that wouldn't help your programs
run under, say, Linux). Has anybody managed to drive
StarOffice from Python cross-platformly, btw...?
More information about the Python-list