WordNet::Similarity::GlossFinder(3)

NAME
WordNet::Similarity::GlossFinder - module to implement gloss finding methods for WordNet::Similarity measures of semantic relatedness (specifically, lesk and vector)

SYNOPSIS
  use WordNet::QueryData;
  my $wn = WordNet::QueryData->new;
  defined $wn or die "Construction of WordNet::QueryData failed";

  use WordNet::Similarity::GlossFinder;
  my $obj = WordNet::Similarity::GlossFinder->new ($wn);
  my ($err, $errString) = $obj->getError ();
  $err and die $errString;

  my $wps1 = 'england#n#1';
  my $wps2 = 'winston_churchill#n#1';

  # get the glosses of these two synsets, since we are not using a
  # configuation file to specify relations, we will only get the
  # immediate glosses of the two wps entries. The default weight and
  # relation appear in $weight and $relation - these can be modified
  # via a configuration file.

  my ($wps1gloss, $wps2gloss, $weight, $relation ) = $obj -> getSuperGlosses ($wps1, $wps2);
  print "$wps1gloss->[0]\n";
  print "$wps2gloss->[0]\n";
  print "$weight->[0]\n";
  print "$relation->[0]\n";

DESCRIPTION

  Introduction
This class is derived from (i.e., is a sub-class of) WordNet::Similarity. Two of the measures of similarity, provided in this package, viz. WordNet::Similarity::lesk and WordNet::Similarity::vector deal with WordNet glosses. This module provides methods for easy access to the required glosses.

  Methods
This module inherits all the methods of WordNet::Similarity. Additionally, the following methods are also defined.

Public methods

$measure->setPosList()
    Specifies the parts of speech that measures derived from this module support (namely, nouns, verbs, adjectives and adverbs).

    parameters: none

    returns: true

$self->traceOptions()
    Overrides method of same name in WordNet::Similarity. Prints module-specific configuration options to the trace string (if tracing is on). GlossFinder supports module specific options: relation, stop and stem.

    Parameters: none

    Returns: nothing

$self->configure($file)
    Overrides the configure method in WordNet::Similarity. This method loads various data files, such as the stop words and relations.

    Parameters: $file -- path of the configuration file.

    Returns: nothing

$self->getSuperGlosses($wps1, $wps2)
    This method returns a list of large blocks of concatenated glosses (super-gloss) for each specified synset. A super-gloss is the block of text formed by concatenating the glosses of a synset with glosses of synsets related to it in WordNet. "Related" synsets are identified by specific relations specified in the "relations" file. If no relations file was specified in the configuration, only the gloss of that synset is returned.

    Parameters: wps1 and wps2 -- two synsets.

    Returns: List of superglosses for both synsets (2-D array).

Private Methods

$self->_loadRelationFile()
    This method loads relations from a relation file.

    Parameters: none

    Returns: nothing

  Discussion
Many of the methods in this module can work with either offsets or wps strings internally. There are several interesting consequences of each mode.

1.  An offset is not a unique identifier for a synset, but neither is a wps string. An offset only indicates a byte offset in one of the WordNet data files (data.noun, data.verb, etc. on Unix-like systems). An offset along with a part of speech, however, does uniquely identify a synset.

    A word#pos#sense string, on the other hand, is the opposite extreme. A word#pos#sense string is an identifier for a unique word sense. A synset can have several word senses in it (i.e., a synset is a set of word senses that are synonymous). The synset {beer_mug#n#1, stein#n#1} has two word senses. The wps strings 'beer_mug#n#1' and 'stein#n#1' can both be used to refer to the synset. For simplicity, we usually just use the first wps string when referring to the synset. N.B., the wps representation was developed by WordNet::QueryData.

2.  Early versions of WordNet::Similarity::* used offsets internally for finding paths, hypernym trees, subsumers, etc. The module WordNet::QueryData that is used by Similarity, however, accepts only wps strings as input to its querySense method, which is used to find hypernyms. We have found that it is more efficient (faster) to use wps strings internally.

AUTHORS
 Ted Pedersen, University of Minnesota Duluth
 tpederse at d.umn.edu

 Siddharth Patwardhan, University of Utah, Salt Lake City
 sidd at cs.utah.edu

BUGS
None.

SEE ALSO
WordNet::Similarity(3) WordNet::Similarity::vector(3) WordNet::Similarity::lesk(3)

COPYRIGHT
Copyright (c) 2005, Ted Pedersen and Siddharth Patwardhan

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 <http://www.gnu.org/licenses/gpl.txt> and is included in this distribution as GPL.txt.