NAME
FrameNet::WordNet::Detour - a WordNet to FrameNet Detour.
SYNOPSIS
use FrameNet::WordNet::Detour;
# Creation without parameters, $WNHOME and $FNHOME will be used
my $detour = FrameNet::WordNet::Detour->new;
# Creation with some parameters
my $detour2 = FrameNet::WordNet::Detour->new(-wnhome => '/path/to/WordNet',
-fnhome => '/path/to/FrameNet'
-cached => 1,
-limited => undef);
my $result = $detour->query("walk#v#1");
if ($result->is_ok) {
print "Best frames: \n";
print join(' ', @{$result->get_best_framenames})."\n";
print "All frames: \n";
print join(' ', @{$result->get_all_framenames})."\n";
print "All frames with weights: \n";
foreach my $frame (@{$result->get_all_frames}) {
print $frame->name.": ";
print $frame->get_weight."\n";
}
} else {
print $result->message."\n";
}
PREREQUISITS
Since it is a tool that maps from WordNet to FrameNet, you need WordNet and FrameNet. We developed it with WordNet 2.0 and FrameNet 1.1, but the Detour works as well with FrameNet 1.2. The module needs furthermore a few temporary files.
There are two possibilities to set the location of FrameNet and WordNet: You can specify the environment variables FNHOME
and WNHOME
.
In bash:
export WNHOME=~/WordNet-2.0/
export FNHOME=~/FrameNet1.1/
(The exact paths may vary with your installation).
You have to set them if you do not use this possibility - give the paths as strings to the new()-method:
use FrameNet::WordNet::Detour;
my $detour = FrameNet::WordNet::Detour->new(-wnhome => "~/WordNet-2.0",
-fnhome => "~/FrameNet1.1");
Currently, we did not test the detour on Windows, but in theory that should work as well. At least, all path names are platform independent.
DESCRIPTION
The FrameNet-WordNet-Detour takes one or more synsets as input and maps each of them to a set of weighted frames.
WordNet
WordNet is an online lexical reference system whose design is inspired by current psycholinguistic theories of human lexical memory. English nouns, verbs, adjectives and adverbs are organized into synonym sets, each representing one underlying lexical concept. Different relations link the synonym sets.
WordNet is developed at Princeton University.
See http://wordnet.princeton.edu/ for more information.
FrameNet
The Berkeley FrameNet project is creating an on-line lexical resource for English, based on frame semantics and supported by corpus evidence. The aim is to document the range of semantic and syntactic combinatory possibilities (valences) of each word in each of its senses, through computer-assisted annotation of example sentences and automatic tabulation and display of the annotation results.
See http://framenet.icsi.berkeley.edu/ for more information.
Detour
The basic idea behind the Detour system, is that lexical units that evoke the same frame, are related through WordNet -- either as antonyms, hypernyms or whatever. Therefore, it should be possible to compute a frame for a lexical unit, even if the lexical unit is not directly listed in FrameNet.
Generally speaking, for a given synset, the Detour searches the antonyms and hypernyms via WordNet. Then, it looks up in the FrameNet database for each of the searched synsets.
One of these frames should be our target frame (the one we want to have for this LU). For each frame, the Detour then computes a weight (incorporating the number of synsets, the number of frames, the distance of each found synset to the given one).
The frame with the highest weight is the one we searched for.
(A scientific paper about that is in work)
METHODS
- new ( %parameters )
-
Blesses a new Detour-object. Since version 0.93, WordNet::QueryData and WordNet::Similarity objects are no longer required to provide. The detour creates them if it needs them. Since version 0.98, the method expects parameters in the named parameters style that is quite common. The following parameters are supported:
- -wnhome
-
The path to the WordNet installation. Optional. If not given, the environment variable $WNHOME is used.
- -fnhome
-
Path to the FrameNet installation. Optional. If not given, the environment variable $FNHOME is used.
- -wnquerydata
-
The already initialised WordNet::QueryData object.
- -cached
- -verbosity
- -limited
-
See the corresponding methods for details.
- query ( $string )
-
The query-function. Returns a FrameNet::WordNet::Detour::Data-object containing the result.
$string
can be either one synset (e.g. get#v#1) or a word and its part-of-speech (e.g. get#v).If the string one asks for is not recorded in WordNet or if the query-string is not wellformed, then a Data-object will be returned also, but it contains no data, and its method isOK() will return a false value.
A more detailed description of the error can be accessed via getMessage() and will be in verbose output if it is enabled (see
set_verbose()
for further information).The query-string can be given in two forms:
get#v#1 -- a fully specified synset or get#v -- a word and its part-of-speech
In either way, the delimiter has to be '#'.
- cached ( )
- uncached ( )
-
Enables or disables the caching.
If caching is enabled, all results are stored in a binary file. The file is located in /tmp (or an equivalent). The results are devided into the limited and the unlimited ones and stored in different files.
Default: Cached.
- limited ( )
- unlimited ( )
-
Enables or Disables the limited-mode.
In the limited mode, the query-synset itself will not be asked for in FrameNet. Normally, there should be no need to use the limited mode, since one could easily get the frames to a synset, when it is specified as lexical unit in FrameNet. In this case, there is no need for this whole script either.
Default: Unlimited.
- set_verbose ( )
- set_debug ( )
- unset_verbose ( )
-
As the names allready tell, with these methods, one can set different modes of output. If the script is in verbose-mode, some information during the work is printed out. If the script runs in debug-mode, information as much as possible will be printed out. With
unset_verbose()
, no information at all will be printed.All output goes to STDERR.
Default: No verbose, no debug.
- matched ( )
-
Sets the package in matched mode
- unmatched ( )
-
Disables the matching mode
- round ( $number )
-
Returns a rounded number that has only two decimals. Static method.
- version ( )
-
Returns the version number of the module.
- best_frame ( )
-
Returns the best matching frame.
- reset ( )
-
Resets the package, such that a new synset can be queried.
KNOWN BUGS
- More than one detour object accessing the same cache lead to segmentation faults.
Please report bugs to mailto:reiter@cpan.org.
COPYRIGHT
Copyright 2005 Aljoscha Burchardt and Nils Reiter. 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
http://framenet.icsi.berkeley.edu/