Re: counting mispelled words


Subject: Re: counting mispelled words
captgoodnight@acsalaska.net
Date: Thu Jan 22 2004 - 19:12:12 AKST


If ya need a dictionary file in text/newlines for the below script, you might
want to use this,

cat /usr/lib/ispell/english.hash | strings | tr 'A-Z' 'a-z' | grep '^[a-z]' |
sort -u > mydict = creates a dictionary

just a thought.

bests,
eddie

On Wednesday 21 January 2004 10:41 pm, Mac Mason wrote:
> So, I was bored, and wrote you a program.
>
> It's reproduced below; copy into a file, make executable, and read the
> header comment to see how to use it.
>
> #! /usr/bin/perl
>
> #
> # Written by Mac Mason on a whim; spits out number of misspelled words.
> # Uncommenting one line will allow printing of misspelled words.
> # Program is pretty dumb; it requires the dictionary to have every word
> # seperated by newlines.
> #
>
> use strict;
>
> my $counter = 0;
>
> if (@ARGV < 2)
> {
> print "Need two arguments; \'./program DICTIONARY FILE_TO_CHECK\'\n"
> }
>
> my $dictfile = @ARGV[0];
> my $checkfile = @ARGV[1];
>
> open DICT, "$dictfile" or die "Can't open dictionary!";
> open FILE, "$checkfile" or die "Can't open file to check!";
>
> chomp(my @temp = <DICT>);
>
> my %dict;
>
> foreach (@temp)
> {
> $dict{$_} = 1;
> }
>
> while (<FILE>)
> {
> my @line = split;
>
> foreach (@line)
> {
> if (!exists $dict{$_})
> {
> $counter++;
> # print "$_\n"; # Uncomment to get printout of words
> }
> }
> }
>
> print "$counter misspelled words\n";
>
>
> # End of program
>
>
> Have fun!
>
>
> ~Mac~
>
> ---------
> To unsubscribe, send email to <aklug-request@aklug.org>
> with 'unsubscribe' in the message body.

-- 
ICQ# 294477332
Where ravens sleep
No object can stop the driving rain
In wind, the smallest object can be deadly
Face the sun, to not see the shadows
Linux

--------- To unsubscribe, send email to <aklug-request@aklug.org> with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Thu Jan 22 2004 - 19:21:57 AKST