NAME
WordNet - perl interface for noun relations of WordNet
SYNOPSIS
use WordNet;
print "Definition: ", &WordNet::gloss ("car\#1"), "\n"; print "Synset: ", join (", ", &WordNet::syns ("car\#1")), "\n"; print "Hypernyms: ", join (", ", &WordNet::hype ("car\#1")), "\n"; my @hypes = &WordNet::hype("car\#1"); print "Hype Synset: ", join (", ", &WordNet::syns ($hypes[0])), "\n"; print "Hype-Hypernyms: ", join (", ", &WordNet::hype ($hypes[0])), "\n"; print "Hyponyms: ", join (", ", &WordNet::hypo ("car\#1")), "\n"; print "Meronyms: ", join (", ", &WordNet::mero ("car\#1")), "\n"; print "Holonyms: ", join (", ", &WordNet::holo ("roof\#2")), "\n";
my @sensearray = &WordNet::syns ("car");
print "Num Senses: ", scalar @sensearray, "\n"; for (my $i=0; $i < scalar @sensearray; $i++) { print $i+1, ") ", join (", ", @{$sensearray[$i]}), "\n"; }
DESCRIPTION
The WordNet perl module uses the 'wn' command-line program to give a more palatable interface to the WordNet system. Before the WordNet perl module can be used, the WordNet C code must be installed on your system and the 'wn' executable must be located in a directory that is part of your PATH variable.
When a query is performed, the module gathers data from 'wn', caches it in memory and returns the requested information. This mechanism makes accessing WordNet information both efficient and more natural. The WordNet module requires little effort to traverse the various graphs of information that are available in the WordNet system.
USAGE
The WordNet module includes six exported functions, each of which operate in two different modes. The functions are:
syns - Returns the synonym set of the provided word
gloss - Returns the glossary definition of the provided word
hype - Returns all hypernyms one level above the provided word
hypo - Returns all hyponyms one level below the provided word
mero - Returns all meronyms (part/member/substance of parents) of the provided word
holo - Returns all holonyms (part/member/substance of children) of the provided word
Each word accepts a single string that is the word to be queried. In the case that the exact sense of the word is known, that may be provided in the string using the #S notation (where 'S' is the sense number). For example, 'car#1' refers to the first sense of the word 'car'.
The output of each of these function depends on the format of the input and is probably best described by the examples provided in the SYNOPSIS section (above). Generally, if a specific sense is provided (e.g. 'window#2'), then a list of strings is returned, one for each found instance of the requested object. In the case of the 'gloss' function, a single item is returned (the single definition of that word). If no specific sense is provided, then an array of references is returned. Each reference will point to a list of strings, corresponding to the list that would have been returned given a specific sense query. The array of referneces is ordered according to sense number, with sense #1 coming first and the largest sense coming last. i.e. add one to the array index to get the sense number.
NOTES
Requires existence of WordNet command line program, 'wn'. Currently only allows WordNet queries on noun forms.
COPYRIGHT
Copyright 1999 Jason Rennie <jrennie@mitre.org> All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
perl(1)
http://www.cogsci.princeton.edu/~wn/
LOG
$Log: WordNet.pm,v $ Revision 1.5 1999/07/20 16:17:09 jrennie missing '>' in hash dereference
Revision 1.4 1999/07/19 14:19:53 jrennie use CVS for versioning ($VERSION line taken from CPAN suggestion)
Revision 1.3 1999/07/19 14:09:19 jrennie various fixes in parsing of 'wn' output -- particularly for special cases ('wn' does not have the requested information)
Revision 1.2 1999/07/16 19:51:06 jrennie deal with empty holo or mero wn output (different from other queries)
Revision 1.1.1.1 1999/07/16 18:27:02 jrennie move WordNet to separate directory
Revision 1.9 1999/07/16 18:04:12 jrennie bug fix---forgot to convert synlist to hash
Revision 1.8 1999/07/16 14:55:48 jrennie various clean up to make "use strict" happy; do the right thing for top and bottom of tree
Revision 1.7 1999/07/15 16:41:09 jrennie updated documentation
Revision 1.6 1999/07/15 15:27:42 jrennie allow arbitrary sense querying
Revision 1.5 1999/07/14 22:38:48 jrennie complete rewrite; created separate function for each aspect of wordnet (gloss, synset, hype, hypo, mero, holo); still need to allow for querying w/o a specific sense
Revision 1.4 1999/07/13 15:28:22 jrennie add example for ambiguous mode
Revision 1.3 1999/07/13 15:16:50 jrennie Follow guidelines in perl FAQ
Revision 1.2 1999/07/13 13:48:09 jrennie quote query words passed to wn