in reply to Re: reading dictionary file -> morphological analyser
in thread reading dictionary file -> morphological analyser
Just to elaborate a bit on the hash approach, here's a very simple example of how you would populate the hash and then look up some value(s):
#!/usr/bin/perl my %dict; # the hash while (my $line = <DATA>) { chomp $line; $dict{$line}++; # instead of ++ you could also assign some value. +.. } my @inputs = qw( foo fooed fooen prefoo postfoo ); for my $input (@inputs) { print "found '$input' in lexicon\n" if exists $dict{$input}; } # I'm using the special DATA filehandle here to be able to inline it.. +. # That would be your DICTE handle supplying all the precomputed 385090 + lines __DATA__ foo prefoo bar baz ...
BTW, am I understanding you correctly, that what you mean by 'analyse' is essentially to check whether some given $input is found in the lexicon?
|
|---|