View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Saiyam Kohli > WordNet-Similarity-Visual-007 > WordNet::Similarity::Visual::SimilarityInterface



Annotate this POD


Open  0
View/Report Bugs
Module Version: 0.07   Source  




Basic Usage Example

  use WordNet::Similarity::Visual::SimilarityInterface;

  my $similarity = WordNet::Similarity::Visual::SimilarityInterface->new;


  my ($result,$errors,$traces) = $similarity->compute_similarity($word1,$word2,$measure_index);


This package provides an interface to WordNet::Similarity. It also converts the trace string to the meta-language.


The following methods are defined in this package:

Public methods


The constructor for WordNet::Similarity::Visual::SimilarityInterface objects.

Return value: the new blessed object


To initialize WordNet::Similarity.

Return Value: None


Computes the similarity and relatedness scores for two words.

Parameter: Two Words and the Measure Index "hso","lch","lesk","lin","jcn","path","random","res","vector_pairs","wup" The measure index can have any of the following values - 0 for "all measures"

  - 1 for "Hirst & St-Onge"

  - 2 for "Leacock and Chodorow"

  - 3 for "Adapted Lesk"

  - 4 for "Lin"

  - 5 for "Jiang & Conrath"

  - 6 for "Path Length"

  - 7 for "Random"

  - 8 for "Resnik"

  - 9 for "Vector Pair"

  - 10 for "Wu and Palmer"

Returns: Reference to Hashes containining

  - semantic relatedness/similarity values for all the word senses combination and measures,
  - errorStrings for the word senses and measure which did not return a similarity value
  - TraceString for all the measures that had trace output on

Converts the Trace String to Meta-language.

Parameter: The two Word senses, Trace String and the Measure name

Returns: A String, the equivalent metalanguage for the trace string.


This module provides an interface to the various WordNet::Similarity measures. It implements functions that take as argument two words then find the similarity scores scores for all the senses of these words. This module also implements the funtion that takes as input a tracestring and converts it to the meta-language.


The first line in the meta language is the measure name. The next two line list all the possible shortest paths between the two concepts. The synsets represent the nodes along these paths, thile the relation names between these synsets represent the edges. If there is more than one shortest path they are also listed. The alternate shortest paths are seperated using the OR operator. The rest of the lines list all the other paths in the hypernym tree. These alternate hypernym trees also use the same system as used in the shortest path. The next line is the maximum depth of the hypertree

    cat#n#1 hypernym feline#n#1 hypernym carnivore#n#1
    dog#n#1 hypernym canine#n#2 hypernym carnivore#n#1
    carnivore#n#1 hypernym placental#n#1 hypernym mammal#n#1 hypernym vertebrate#n#1 hypernym
      chordate#n#1 hypernym animal#n#1 hypernym organism#n#1 hypernym living_thing#n#1 hypernym
      object#n#1 hypernym entity#n#1 hypernym Root#n#1
    Max Depth = 13
    Path length = 5


WordNet::Similarity WordNet::QueryData

Mailing List: <>


Saiyam Kohli, University of Minnesota, Duluth

Ted Pedersen, University of Minnesota, Duluth


Copyright (c) 2005-2006, Saiyam Kohli and Ted Pedersen

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to

    The Free Software Foundation, Inc.,
    59 Temple Place - Suite 330,
    Boston, MA  02111-1307, USA.

Note: a copy of the GNU General Public License is available on the web at <> and is included in this distribution as GPL.txt.

syntax highlighting: