edu.mit.jwi.item
Interface ISenseKey

All Superinterfaces:
java.lang.Comparable<ISenseKey>, IHasPOS, java.io.Serializable
All Known Implementing Classes:
SenseKey

public interface ISenseKey
extends IHasPOS, java.lang.Comparable<ISenseKey>, java.io.Serializable

A sense key is a unique string that identifies a Wordnet word (an IWord). The canonical string representation is:

 lemma%ss_type:lex_filenum:lex_id:head_word:head_id
 
To transform a String representation of a sense key into an actual sense key, use the SenseKeyParser class.

Since:
JWI 2.1.0
Version:
2.4.0
Author:
Mark A. Finlayson

Method Summary
 int getHeadID()
          Returns the head id for this sense key.
 java.lang.String getHeadWord()
          Returns the head word for this sense key.
 java.lang.String getLemma()
          The lemma (root form) of the word indicated by this key.
 ILexFile getLexicalFile()
          Returns the lexical file associated with this sense key.
 int getLexicalID()
          Returns the lexical id for this sense key, which is a non-negative integer.
 int getSynsetType()
          Returns the synset type for the key.
 boolean isAdjectiveSatellite()
          Returns true if this sense key points to an adjective satellite; false otherwise.
 boolean needsHeadSet()
          This method will always return false if the isAdjectiveSatellite() returns false.
 void setHead(java.lang.String headLemma, int headLexID)
          This method is used to set the head for sense keys for adjective satellites, and it can only be called once, directly after the relevant word is created.
 
Methods inherited from interface edu.mit.jwi.item.IHasPOS
getPOS
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getLemma

java.lang.String getLemma()
The lemma (root form) of the word indicated by this key. The returned lemma will not be null, empty, or all whitespace.

Returns:
the lemma for this key
Since:
JWI 2.1.0

getSynsetType

int getSynsetType()
Returns the synset type for the key. 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
 

Returns:
the synset type, an integer between 1 and 5, inclusive
Since:
JWI 2.1.0

isAdjectiveSatellite

boolean isAdjectiveSatellite()
Returns true if this sense key points to an adjective satellite; false otherwise.

Returns:
true if this sense key points to an adjective satellite; false otherwise
Since:
JWI 2.1.0

getLexicalFile

ILexFile getLexicalFile()
Returns the lexical file associated with this sense key. This method should not return null. If the lexical file is unknown, an appropriate object to return is an UnknownLexFile object obtained via the LexFile.getLexicalFile(int) method.

Returns:
the lexical file associated with this sense key
Since:
JWI 2.1.0

getLexicalID

int getLexicalID()
Returns the lexical id for this sense key, which is a non-negative integer.

Returns:
the non-negative lexical id for this sense key
Since:
JWI 2.1.0

getHeadWord

java.lang.String getHeadWord()
Returns the head word for this sense key. The head word is only present if the sense is an adjective satellite synset, and it is the lemma of the first word of the satellite's head synset. If this sense key is not for an adjective synset, this method returns null. If non- null, the head word will be neither empty or nor all whitespace.

Returns:
the head word for this adjective satellite synset, or null if the indicated sense is not an adjective satellite
Since:
JWI 2.1.0

getHeadID

int getHeadID()
Returns the head id for this sense key. The head id is only present if the sense is an adjective satellite synset, and is a two digit decimal integer that, when appended onto the head word, uniquely identifies the sense within a lexicographer file. If this sense key is not for an adjective synset, this method returns -1.

Returns:
the head id for this adjective satellite synset, or -1 if the indicated sense is not an adjective satellite
Since:
JWI 2.1.0

setHead

void setHead(java.lang.String headLemma,
             int headLexID)
This method is used to set the head for sense keys for adjective satellites, and it can only be called once, directly after the relevant word is created. If this method is called on a sense key that has had its head set already, or is not an adjective satellite, it will throw an exception.

Parameters:
headLemma - the head lemma to be set
headLexID -
Throws:
java.lang.IllegalStateException - if this method has already been called, if the headLemma is empty or all whitespace or if the headLexID is illegal.
java.lang.NullPointerException - if the headLemma is null
Since:
JWI 2.1.0

needsHeadSet

boolean needsHeadSet()
This method will always return false if the isAdjectiveSatellite() returns false. If that method returns true, this method will only return true if setHead(String, int) has not yet been called.

Returns:
true if the head lemma and lexical id need to be set; false otherwise.
Since:
JWI 2.1.0


Copyright © 2007-2013 Massachusetts Institute of Technology. All Rights Reserved.