WordNet::SenseKey - convert WordNet sense keys to sense numbers, and v.v.


WordNet-SenseKey documentation  | view source Contained in the WordNet-SenseKey distribution.

Index


NAME

Top

WordNet::SenseKey - convert WordNet sense keys to sense numbers, and v.v.

SYNOPSIS

Top

   use WordNet::QueryData;
   use WordNet::SenseKey;

   my $wn = WordNet::QueryData->new("/usr/share/wordnet");
   my $sk = WordNet::SenseKey->new($wn);

   my $skey = $sk->get_sense_key("run#v#2");
   print "Found the sense key $skey for run#v#2\n";

   my $sense = $sk->get_sense_num($skey);
   print "Found sense $sense for key $skey\n";

   my @synset = $sk->get_synset($skey);
   print "Synset is @synset\n";

   my $can = $sk->get_canonical_sense("escape", "run%2:38:04::");
   print "Found sense $can\n";

DESCRIPTION

Top

 The WordNet::Similarity package is designed to work with words in the
 form of lemma#pos#num  where "lemma" is the word lemma, "pos" is the 
 part of speech, and "num" is the sense number.  Unfortuantely, the 
 sense numbering is not stable from one WordNet release to another.
 Thus, for external programs, it can often be more useful to work with 
 sense keys. Unfortunately, the Wordnet::Similarity package is unaware 
 of sense keys. This class fills that gap.

 WordNet senses keys are described in greater detail in

   http://wordnet.princeton.edu/man/senseidx.5WN.html

 There are four routines implemented here:

    get_sense_key($sense);
    get_sense_num($sense_key);
    get_synset($sense_key);
    get_canonical_sense($lemma, $sense_key);

get_sense_key

 Given a word sense, in the form of lemma#pos#num, this method returns
 the corresponding sense key, as defined by WordNet. Here, "lemma" is the
 word lemma, "pos" is the part of speech, and "num" is the sense number.
 The format of WordNet sense keys is documented in senseidx(5WN), one of 
 the WordNet man pages. 

 Returns an undefined value if the sense key cannot be found.
 The 'get_sense_num' method performs the inverse operation.

get_sense_num

 Given a WordNet sense key, this method returns the corresponding
 word-sense string, in the lemma#pos#num format.  This function is the
 inverse of the get_sense_key method; calling one, and then the other,
 should always return exactly the original input.

 Returns an undefined value if the sense cannot be found.

get_synset

 Given a WordNet sense key, this method returns a list of other sense
 keys that belong to the same synset.

get_canonical_sense

 Senses in a synset all have different lemmas.  This function selects
 one particular element of a synset, given a lemma, and any other member
 of the synset. Thus, for example, run%2:38:04::  and escape%2:38:02:: 
 belong to the same synset. Then

   get_canonical_sense("escape", "run%2:38:04::");

 will return escape%2:38:02::, as this is the sense of "escape" that
 belongs to the same synset as run%2:38:04::.  Returns an undefined
 value if the sense cannot be found.

SEE ALSO

Top

 senseidx(5WN), WordNet::Similarity(3), WordNet::QueryData(3)

 http://wordnet.princeton.edu/
 http://www.ai.mit.edu/~jrennie/WordNet
 http://groups.yahoo.com/group/wn-similarity

AUTHOR

Top

 Linas Vepstas <linasvepstas@gmail.com>

COPYRIGHT AND LICENSE

Top


WordNet-SenseKey documentation  | view source Contained in the WordNet-SenseKey distribution.