edu.mit.jverbnet.data
Class WordnetKey

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

public class WordnetKey
extends java.lang.Object
implements IWordnetKey

Default implementation of the IWordnetType interface.

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

Field Summary
static java.util.regex.Pattern regex
          Regular expression pattern for matching a wordnet key string.
 
Constructor Summary
WordnetKey(java.lang.String lemma, int ssType, int lexFileNum, int lexID)
          Constructs a new wordnet type (a.k.a., sense key).
 
Method Summary
 int compareTo(IWordnetKey key)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.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 usually 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(java.lang.String key)
          Parses a string into a Wordnet type object.
 java.lang.String toString()
           
static java.lang.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
 

Field Detail

regex

public static final java.util.regex.Pattern regex
Regular expression pattern for matching a wordnet key string.

Since:
JVerbnet 1.1.0
Constructor Detail

WordnetKey

public WordnetKey(java.lang.String lemma,
                  int ssType,
                  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 java.lang.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 usually 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 java.lang.Comparable<IWordnetKey>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.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 java.lang.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:
java.lang.NullPointerException - if the specified key is null
Since:
JVerbnet 1.0.0

parseKey

public static WordnetKey parseKey(java.lang.String key)
Parses a string into a Wordnet type object.

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


Copyright © 2012 ${project.organization.name}. All Rights Reserved.