locked_user zanruka has asked for the wisdom of the Perl Monks concerning the following question:
use porter; # load the porter stemmer module print "Please type in the word you would like to spell check.\n"; $word = <STDIN>; $stem = porter($word); print "$word has been shortened to $stem for the purpose of spell chec +king!\n"; open (DICT, "dictionary.txt") || die "cant open dictionary.txt\n"; # O +pen the dictionary file for reading while (<DICT>) { $dict = $_; #Take a line of the file and put it into a variable chomp($dict); #strip out any control characters ie \n \cf etc $dictionary{$dict} = $dict; #Create a hash of the words in the dic +tionary #foreach $dict } $offset = 0; while ($stem gt $offset) { $ngram = substr($stem,$offset,2); foreach $ngram (@ngram) { print "@ngram\n"; } $offset++; } close (DICT);
Update: id like to thank everyone that helped me out while i was in a bit of a rut, with the contributions of the helpful people here and a few very late nights it finally does what its supposed to do, thanks again!!
| Replies are listed 'Best First'. | |
|---|---|
|
Re: dice's coefficient
by moritz (Cardinal) on Apr 13, 2008 at 22:45 UTC | |
|
Re: dice's coefficient
by GrandFather (Saint) on Apr 13, 2008 at 23:21 UTC | |
by Anonymous Monk on Apr 14, 2008 at 07:51 UTC | |
by GrandFather (Saint) on Apr 14, 2008 at 09:57 UTC | |
by Anonymous Monk on Jan 14, 2012 at 10:49 UTC | |
by AnomalousMonk (Archbishop) on Jan 14, 2012 at 12:00 UTC | |
by Anonymous Monk on Jan 15, 2012 at 02:27 UTC | |
|
Re: dice's coefficient
by ysth (Canon) on Apr 14, 2008 at 04:21 UTC | |
by hiddenOx (Novice) on Apr 19, 2008 at 06:20 UTC | |
|
Re: thanks very much
by ww (Archbishop) on Apr 17, 2008 at 02:53 UTC |