NAME

Lingua::Wordnet::Analysis - Perl extension for high-level processing of Wordnet databases.

SYNOPSIS

use Lingua::Wordnet::Analysis;

$analysis = new Lingua::Wordnet::Analysis;

# How many articles of clothing have 'tongues'?
$tongue = $wn->lookup_synset("tongue","n",2);
@articles = $analysis->search($clothes,$tongue,"all_meronyms");

# Are there any parts, of any kinds, of any shoes, made of glass?
@shoe_types = $analysis->traverse("hyponyms",$shoes);
$count = $analysis->search(@shoe_types,$glass,"stuff_meronyms");

# Compute the intersection of two lists of synsets
@array1 = $shoes->all_holonyms;
@intersect = $analysis->intersection
      (\@{$shoes->attributes},\@{$socks->attributes});

# Generate a list of the inherited comp_meronyms for "apple"
@apple_hypernyms = $analysis->traverse("hypernyms",$apple);
@apple_parts = $analysis->traverse("comp_meronyms",@apple_hypernyms);

DESCRIPTION

Lingua::Wordnet::Analysis supplies high-level functions for analysis of word relationships. Most of these functions process and return potentially large amounts of data, so only use them if you "know what you are doing."

These functions could have been put into Lingua::Wordnet::Synset objects, but I wanted to keep those limited to core functionality. Besides, many of these functions have unproven usefulness.

Lingua::Wordnet::Analysis functions

$analysis->match(SYNSET,ARRAY)

Finds any occurance of SYNSET in the synset list ARRAY and the list's pointers. Returns a positive value if a match is found. match() does not traverse.

$analysis->search(SYNSET1,SYNSET2,POINTER)

Searches all pointers of type POINTER in SYNSET1 for SYNSET2. search() is recursive, and will traverse all depths. Returns the number of matches.

$analysis->traverse(POINTER,SYNSET)

Traverses all pointer types of POINTER in SYNSET and returns a list of all synsets found in the tree.

$analysis->coordinates(SYNSET)

Returns a list of the coordinate sisters of SYNSET.

$analysis->union(LIST)

Returns a list of synsets which is the union of synsets LIST. The union consists of synsets which occur in any lists. This is useful, for example, for determining all the holonyms for two or more synsets.

$analysis->intersection(ref LIST)

Returns a list of synsets of the intersection of ARRAY1 list of synsets with ARRAY2 list of synsets. The intersection consists of synsets which occur in both lists. This is useful, for example, to determine which meronyms are shared by two synsets:

@synsets = $analysis->intersection
    (\@{$synset1->all_meronyms},\@{$synset2->all_meronyms});
$analysis->distance(SYNSET1,SYNSET2,POINTER)

Returns an integer value representing the distance in pointers between SYNSET1 and SYNSET2 using POINTER as the search path.

EXAMPLES

To print out an inherited meronym list, use traverse():

$orange = $wn->lookup_synset("orange","n",1);
@orange_hypernyms = $analysis->traverse("hypernyms",$orange);
foreach ($analysis->traverse("all_meronyms",@orange_hypernyms)) {
    print $_->words, "\n";
}

Note that the inherited meronyms will not contain the direct meronyms of $orange.

BUGS/TODO

There is tons that could go in this module ... submissions are welcome!

Lots of cleanup.

Need to add a search_path function that will return a path to a match as a linked list or hash of hashes.

Some might want inherited meronym/holonym trees.

Please send bugs and suggestions/requests to dbrian@brians.org. Development on this module is active as of Winter 2000.

AUTHOR

Copyright (C)2000, Daniel Brian.

D. Brian, dbrian@brians.org.

SEE ALSO

Lingua::Wordnet.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 45:

'=item' outside of any '=over'

Around line 81:

You forgot a '=back' before '=head1'