#! C:\Perl\bin -w use strict; use warnings; # Sample Perl program, showing how to use the # WordNet::Similarity measures. # WordNet::QueryData is required by all the # relatedness modules. use WordNet::QueryData; # 'use' each module that you wish to use. use WordNet::Similarity::wup; # Get the concepts. my $wps1 = shift; my $wps2 = shift; # Load WordNet::QueryData use DBM::Deep; my $h = DBM::Deep->new("wordnet.db")->{foo}; #convert the top level to regular hash my $wn = {}; %$wn=%$h; delete $wn->{data_fh}; #restore contents of $wn->{data_fh} bless $wn, 'WordNet::QueryData'; $wn->openData; # Create an object for each of the measures of # semantic relatedness. my $wup = WordNet::Similarity::wup->new($wn, "/config-files/config-wup.conf"); # Find the relatedness of the concepts using each of # the measures. my $value = $wup->getRelatedness($wps1, $wps2);