in reply to Spell Check
If you have a dictionary file (like /usr/dict/words under UNIX) it is easy to write a simple misspelling-detector in perl:
This could be enhanced significantly, but will get you started on the right path.my %dict; open D,"</usr/dict/words"; while(<D>){ chomp; $dict{lc($_)}=$_; } close D; my $text='Is there anyway to write a spell checker in perl?? Please he +lp.'; my @words=split /[^a-zA-Z0-9']+/,$text; foreach (@words){ if(!defined $dict{lc($_)}){ print "\"$_\" is not in the dictionary\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Spell Check
by jdporter (Paladin) on Jun 30, 2003 at 20:45 UTC |