in reply to reading dictionary file -> morphological analyser
by using the very fast hash, retrieving it from a file previously generated, it works very faster. so, again, thank you for the responses, they were very helpful for finding a good approach for our problem. note: we are not professional linguists nor professional programmers (we can't work yet, anyway, because of our age), we do this just because we like (the programming part and the lingustic part). by the way, we are from Brazil, and we are twins (it explains the "we"'s). salutations.#!c:\perl\bin\perl use Storable; #use this for calling the hash storing functions. my %dict; # the hash while (my $line = <DATA>) { chomp $line; $dict{$line}++; # instead of ++ you could also assign some value. +.. } store(\%dict, "hash.txt"); #store the hash in the file. %dict = %{retrieve("hash.txt")}; #retrieve the hash from the file "has +h.txt". thus, it only needs to be generated once. my @inputs = qw( foo fooed fooen prefoo postfoo ); for my $input (@inputs) { print "found '$input' in lexicon\n" if exists $dict{$input}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: reading dictionary file -> morphological analyser
by pc2 (Beadle) on Jul 18, 2007 at 11:45 UTC |