Wordnet installed in /usr/share/wordnet, and WNHOME set correctly.
#!/usr/bin/perl -w
my $splitter = new Lingua::EN::Splitter;
my $wn = WordNet::QueryData->new( noload => 1, dir => "/usr/share/wordnet/",);
my $sentence =
"The meeting minutes for the October 1st board meeting is now public.";
my $words = $splitter->words( $sentence );
my @POS;
my $max_num_pos = 0;
# Find part of speech for each word in the sentence
foreach my $word ( @$words ){
my $parts =
[ map { s/^$word#//; uc } $wn->querySense($word) ];
$max_num_pos = int(@$parts)
if($max_num_pos < int(@$parts));
push(@POS, $parts);
}
my $word_count = int(@$words);
my $format = join ('|', map{' %-8s'} (1 .. $word_count));
my $out = sprintf($format, @$words);
my $outLen = length $out;
print($out, "\n",
'-' x $outLen, "\n"
);
for( my $i = 0; $i < $max_num_pos; $i++ ){
my @row;
for( my $j = 0; $j < $word_count; $j++ ){
if( exists $POS[$j]->[$i] ){
push(@row, $POS[$j]->[$i]);
}else{
push(@row, "");
}
}
printf($format."\n", @row);
}
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google
> Groups "wn-perl" group.
> To post to this group, send email to wn-...@googlegroups.com
> To unsubscribe from this group, send email to wn-perl
> +unsub...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/wn-perl?hl=en
> -~----------~----~----~----~------~----~------~--~---
>