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::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 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 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 greater than that represents an error and $errString contains the possible error.

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.

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.

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.

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

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 88:

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

Around line 94:

=over without closing =back