Help on finding word is valid as per English Dictionary through python

Shashwat Anand anand.shashwat at gmail.com
Fri Jun 25 10:20:55 EDT 2010


why do you need that ?
which platform are you onto ?

On OSX you can use 'DictionaryServices' API
eg.,

import sys
import DictionaryServices
word = " ".join(sys.argv[1:])
print DictionaryServices.DCSCopyTextDefinition(None, word, (0, len(word)))

Gives the meaning of the input word (works with python 2.5)

You can use this script for Vi  (~/.vimrc) if you want, control+a will do a
spell check.

" Toggle Spell-Check
set spell spelllang=
function ToggleSpellCheck()
 if &spelllang == "en"
set spelllang=
else
 set spelllang=en
endif
endfunction
command! ToggleSpellChecking call ToggleSpellCheck()
nmap <c-a> :ToggleSpellChecking<cr>

But again am not aware of your use case.

On Fri, Jun 25, 2010 at 7:19 PM, Thomas Jollans <thomas at jollans.com> wrote:

> On 06/25/2010 03:30 PM, anu python wrote:
> > Hi,
> >               I have a text file ,
> > a.txt
> > ------------------------
> >
> > this is a lcose button
> >
> > where u can observer  "lcose"  is not a valid word.It's typing
> > mistake.Actual word is "close".
> >
> > How can i check that each word entered in txt file having correct
> > meaningful words as per English Dictionary.
> >
> > Do you have any package which can check "English Dictionary"
>
> In a pinch, I might use open("/usr/share/dict/words", "r") as a
> thesaurus, and check for words in there. Read the file and create a
> giant frozenset or something. For something a bit more civilized, I
> expect that there's a python package interfacing at least one of
> (ispell, aspell, hunspell, myspell) (and what they're all called.
>
> There is a multitude of "English dictionaries". Some don't even include
> "neighbour", imagine that!
>
> >
> > Please help me.
> >
> > Thanks,
> > Anu
> >
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100625/7d570987/attachment-0001.html>


More information about the Python-list mailing list