Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Spell Check

by swiftone (Curate)
on May 30, 2000 at 19:15 UTC ( [id://15410]=note: print w/replies, xml ) Need Help??


in reply to Spell Check

I have no doubt that there are modules that do this (Perhaps Text::Ispell or Lingua::Ispell?), but for a quick 1 minute inefficient version, try:

$dictfile="/some/path/to/dictfile"; #Dictfile should have a all words (or regex for words), one per line open (DICT, $dictfile) or die "Can't open $dictfile:$!"; while(<DICT>){ $words{lc($_)}=1; #using hash as cheap lookup #Note that a "real" dictionary file will nail you on efficency her +e. Perhaps a Dbm would be better? } while(<>){ foreach $word (split($_)){ if (!defined($words{lc($word)})){ print "$.:$word?\n"; } } }
(Now the perl wizards will trounce this code, but I'll post it anyways in hopes of learning from them.)

Replies are listed 'Best First'.
RE: Re: Spell Check
by perlcgi (Hermit) on May 30, 2000 at 19:40 UTC
    Now the perl wizards will trounce this code
    Let them, indeed. But you'll still get my vote. Pretty cool in my ragged little book :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://15410]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-25 06:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found