edu.mit.jverbnet.data
Class WordnetKey

java.lang.Object
  extended by edu.mit.jverbnet.data.WordnetKey
All Implemented Interfaces:
IWordnetKey, Comparable<IWordnetKey>

public class WordnetKey
extends Object
implements IWordnetKey

Default implementation of the IWordnetType interface.

Since:
JVerbnet 1.0.0
Version:
1.0.0
Author:
Mark A. Finlayson

Constructor Summary
WordnetKey(String lemma, int lexFileNum, int lexID)
          Constructs a new wordnet type (a.k.a., sense key).
 
Method Summary
 int compareTo(IWordnetKey key)
           
 boolean equals(Object obj)
           
 String getLemma()
          The lemma (root form) of the word indicated by wordnet type.
 int getLexicalFileNumber()
          Returns the lexical file number associated with this wordnet type.
 int getLexicalID()
          Returns the lexical id for this sense key, which is a non-negative integer.
 int getSynsetType()
          Returns the synset number for the type, which will be 2 for all verbnet types.
 int hashCode()
           
static int hashCode(IWordnetKey key)
          Calculates a hash code for a wordnet type object.
static WordnetKey parseKey(String key)
          Parses a string into a Wordnet type object.
 String toString()
           
static String toString(IWordnetKey key)
          Returns a a string representation of the specified sense key object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WordnetKey

public WordnetKey(String lemma,
                  int lexFileNum,
                  int lexID)
Constructs a new wordnet type (a.k.a., sense key).

Parameters:
lemma - the lemma for the sense key
lexFileNum - the lexical file number of the sense key. Must be between 0 and 99, inclusive, according to the Wordnet documentation.
lexID - the lexical id of the sense key. Must be between 0 and 15, inclusive, according to the Wordnet documentation.
Since:
JVerbnet 1.0.0
Method Detail

getLemma

public String getLemma()
Description copied from interface: IWordnetKey
The lemma (root form) of the word indicated by wordnet type. The returned lemma will not be null, empty, or all whitespace.

Specified by:
getLemma in interface IWordnetKey
Returns:
the lemma of the type

getSynsetType

public int getSynsetType()
Description copied from interface: IWordnetKey
Returns the synset number for the type, which will be 2 for all verbnet types. In general, the synset type is a one digit decimal integer representing the synset type for the sense.
 1=NOUN
 2=VERB
 3=ADJECTIVE
 4=ADVERB
 5=ADJECTIVE SATELLITE
 

Specified by:
getSynsetType in interface IWordnetKey
Returns:
the synset type, 2

getLexicalFileNumber

public int getLexicalFileNumber()
Description copied from interface: IWordnetKey
Returns the lexical file number associated with this wordnet type.

Specified by:
getLexicalFileNumber in interface IWordnetKey
Returns:
the lexical file number associated with this wordnet type

getLexicalID

public int getLexicalID()
Description copied from interface: IWordnetKey
Returns the lexical id for this sense key, which is a non-negative integer.

Specified by:
getLexicalID in interface IWordnetKey
Returns:
the non-negative lexical id for this sense key

compareTo

public int compareTo(IWordnetKey key)
Specified by:
compareTo in interface Comparable<IWordnetKey>

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public static int hashCode(IWordnetKey key)
Calculates a hash code for a wordnet type object.

Parameters:
key - the wordnet type for which to calculate a hash code
Returns:
the has code for the object
Since:
JVerbnet 1.0.0

toString

public static String toString(IWordnetKey key)
Returns a a string representation of the specified sense key object.

Parameters:
key - the sense key to be encoded as a string
Returns:
the string representation of the sense key
Throws:
NullPointerException - if the specified key is null
Since:
JVerbnet 1.0.0

parseKey

public static WordnetKey parseKey(String key)
Parses a string into a Wordnet type object. This method ignores the ss_type field, assuming it is equal to 2.

Parameters:
key - the string to be transformed into a Wordnet type object
Returns:
the Wordnet type object representing this String
Throws:
IllegalArgumentException - if the string is not a properly formatted Wordnet type
Since:
JVerbnet 1.0.0


Copyright © 2012 Massachusetts Institute of Technology. All Rights Reserved.