NAME

WordNet::Extend::Insert - Perl module for inserting a lemma into WordNet.

SYNOPSIS

Basic Usage Example

use WordNet::Extend::Insert;

my $insert = WordNet::Extend::Insert->new();

@in1 = ("crackberry","noun","withdef.1", "A BlackBerry, a handheld device considered addictive for its networking capability.");    

@in2 = ("slackberry","noun","withdef.2", "A mocking name for crackberry.");

@loc1 = ("withdef.5","cellphone#n#1");

@loc2 = ("withdef.6","crackberry#n#1");

$insert->attach(\@in1, \@loc1);

$insert->merge(\@in2, \@loc2);

DESCRIPTION

Introduction

WordNet is a widely used tool in NLP and other research areas. A drawback of WordNet is the amount of time between updates. WordNet was last updated and released in December, 2006, and no further updates are planned. WordNet::Extend::Insert aims to allow developers insert their own lemmas into WordNet which can help keep WordNet updated with new language in the world. It can also revert back to the original untouched WordNet (by calling restoreWordNet) if the user makes a mistake or simply wants the untouched WordNet to access.

Methods

The following methods are defined in this package:

Public methods

$obj->new()

The constructor for WordNet::Extend::Insert objects.

Parameters: none.

Return value: the new blessed object

$obj->getError()

Allows the object to check if any errors have occurred. Returns an array ($error, $errString), where $error value equal to 1 represents a warning and 2 represents an error with the requested commands. (If a user would run attach() without enough arguments, the error code would return 2). $errorString contains what error occurred.

Parameter: None

Returns: array of the form ($error, $errorString).

$obj->attach($newSynset, $location)

Takes in a new synset and inserts it into WordNet at the specified location by attaching it to the specified location lemma as a hyponym. The location should be represented by "lemma#pos#senseNum". For example, to attach to the 2nd sense of the noun window, the location would be "window#n#2".

Parameters: Synset array in form (lemma, part-of-speech, item-id, definition) or "word\tpos\titem-id\tdef", and location to be inserted in form (item-id, WordNet sense).

Returns: nothing

$obj->merge($newSynset, $location)

Takes in a new synset and inserts it into WordNet at the specified location by merging it into the specified location lemma as a synset. The location should be represented by "lemma#pos#senseNum". For example, to merge to the 2nd sense of the noun window, the location would be "window#n#2".

Parameters: Synset array in form (lemma, part-of-speech, item-id, definition) or "word\tpos\titem-id\tdef", and location to be inserted in form (item-id, WordNet sense).

Returns: nothing

$obj->restoreWordNet()

Causes all WordNet\dict files to be restored to their original state before any inserts were performed. This is equivalent to installing WordNet\dict fresh on your machine.

Parameter: none

Returns: nothing

$obj->revertLastChange()

Allows the user to undo the last insert made to WordNet.

Parameter: none

Returns: nothing

$obj->isNewWord($lemma, $pos)

Takes in a lemma and searches wordnet to see if it exists.

Parameter: the lemma to search against along with the part of speech.

Returns: 1 if lemma is found or 0 if not.

$obj->getIndexInfo($lemma, $pos)

Takes in lemma and returns the information from the index.pos file.

Parameter: the lemma info required and part of speech

Returns: hash lemma info from index.pos with following information: lemma pos synset_cnt p_cnt ptr_symbol sense_cnt tagsense_cnt synset_offset

$obj->getDataInfo($synsetOffset, $pos)

Takes in synset offset and pos to find data associated with it in data.pos.

Parameters: the synset offset and part of speech

Returns: hash offset info from data.pos with following information: synset_offset lex_filenum ss_type w_cnt 'word_lex_id' p_cnt ptr | gloss

$obj->getSenseInfo($synsetOffset)

Takes in a synset offset and returns the sense associated with the offset.

Parameter: the synset offset of the desired lemma

Returns: a hash offset info from index.sense with data: sense_key synset_offset sense_number tag_cnt

$obj->findNewOffset()

Searches through and calculates the offset for inserting.

Parameters: pos of new lemma

Returns: new unused offset

$obj->changeWNLocation()

NOTE: Method not yet implemented, planned for next update.

Allows the user to temporarily choose the location for WordNet which can be used to change between different WordNet dictionaries.

Parameters: New location ex. "/usr/local/WordNet-3.0"

Returns: nothing

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 92:

You forgot a '=back' before '=head2'

Around line 98:

=over without closing =back