Re: SpellChecker

2009-05-21 Thread abosalim
On May 20, 12:37 pm, Mike Kazantsev wrote: > abosalim wrote: > > I used this code.It works fine,but on word not whole text.I want to > > extend this code to correct > > text file not only a word,but i don't know.If you have any help,please > > inform me. > ... > > def correct(word): > >     candid

Re: SpellChecker

2009-05-20 Thread Peter Otten
abosalim wrote: > I used this code.It works fine,but on word not whole text.I want to > extend this code to correct > text file not only a word,but i don't know.If you have any help,please > inform me. import re import sys def correct(word, _lookup={"teh": "the"}): """ Replace with Norvi

Re: SpellChecker

2009-05-20 Thread Mike Kazantsev
abosalim wrote: > I used this code.It works fine,but on word not whole text.I want to > extend this code to correct > text file not only a word,but i don't know.If you have any help,please > inform me. ... > def correct(word): > candidates = known([word]) or known(edits1(word)) or known_edits2

SpellChecker

2009-05-20 Thread abosalim
I used this code.It works fine,but on word not whole text.I want to extend this code to correct text file not only a word,but i don't know.If you have any help,please inform me. This is the code: import re, collections def words(text): return re.findall('[a-z]+', text.lower()) def train(feature