|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.mit.jwi.item.Word
public class Word
Default implementation of the IWord interface.
| Constructor Summary | |
|---|---|
Word(ISynset synset,
int number,
java.lang.String lemma,
int lexID,
AdjMarker adjMarker,
java.util.List<IVerbFrame> frames,
java.util.Map<IPointer,? extends java.util.List<IWordID>> pointers)
Constructs a new word object. |
|
Word(ISynset synset,
IWordID id,
int lexID,
AdjMarker adjMarker,
java.util.List<IVerbFrame> frames,
java.util.Map<IPointer,? extends java.util.List<IWordID>> pointers)
Constructs a new word object. |
|
| Method Summary | |
|---|---|
static void |
checkLexicalID(int id)
Checks the specified lexical id, and throws an IllegalArgumentException if it is not legal. |
static void |
checkWordNumber(int num)
Checks the specified word number, and throws an IllegalArgumentException if it is not legal. |
boolean |
equals(java.lang.Object obj)
|
AdjMarker |
getAdjectiveMarker()
Returns the adjective marker of this word. |
IWordID |
getID()
Returns the ID object for this item. |
java.lang.String |
getLemma()
Returns the root form of this word, never null or empty. |
int |
getLexicalID()
A integer in the closed range [0,15] that, when appended onto lemma, uniquely identifies a sense within a lexicographer file. |
static java.lang.String |
getLexicalIDForDataFile(int lexID)
Returns a string form of the lexical id as they are written in data files, which is a single digit hex number. |
static java.lang.String |
getLexicalIDForSenseKey(int lexID)
Returns a string form of the lexical id as they are written in sense keys, which is as a two-digit decimal number. |
POS |
getPOS()
Returns the associated part of speech for this object. |
java.util.Map<IPointer,java.util.List<IWordID>> |
getRelatedMap()
Returns an immutable map of from pointers to immutable maps. |
java.util.List<IWordID> |
getRelatedWords()
Returns an immutable list of all word ids related to this word by pointers in the database. |
java.util.List<IWordID> |
getRelatedWords(IPointer type)
Returns an immutable list of all word ids related to this word by the specified pointer type. |
ISenseKey |
getSenseKey()
Returns the sense key for this word. |
ISynset |
getSynset()
Returns the synset uniquely identified by this word. |
java.util.List<IVerbFrame> |
getVerbFrames()
Returns an immutable list of all verb frames associated with this word. |
int |
hashCode()
|
static boolean |
isIllegalLexicalID(int id)
Lexical id's are always an integer in the closed range [0,15]. |
static boolean |
isIllegalWordNumber(int num)
Word numbers are always an integer in the closed range [1,255]. |
java.lang.String |
toString()
|
static java.lang.String |
zeroFillWordNumber(int num)
Returns a string representation of the specified integer as a two hex digit zero-filled string. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Word(ISynset synset,
int number,
java.lang.String lemma,
int lexID,
AdjMarker adjMarker,
java.util.List<IVerbFrame> frames,
java.util.Map<IPointer,? extends java.util.List<IWordID>> pointers)
synset - the synset for the word; may not be nullnumber - the word numberlemma - the word lemma; may not be empty or all whitespacelexID - the lexical idadjMarker - non-null only if this is an adjectiveframes - verb frames if this is a verbpointers - lexical pointers
java.lang.NullPointerException - if the synset is null
java.lang.IllegalArgumentException - if the adjective marker is non-null and this is
not an adjective
public Word(ISynset synset,
IWordID id,
int lexID,
AdjMarker adjMarker,
java.util.List<IVerbFrame> frames,
java.util.Map<IPointer,? extends java.util.List<IWordID>> pointers)
synset - the synset for the word; may not be null the word
lemma; may not be empty or all whitespaceid - the word id; may not be nulllexID - the lexical idadjMarker - non-null only if this is an adjectiveframes - verb frames if this is a verbpointers - lexical pointers
java.lang.NullPointerException - if the synset or word ID is null
java.lang.IllegalArgumentException - if the adjective marker is non-null and this is
not an adjective| Method Detail |
|---|
public IWordID getID()
IItemnull.
getID in interface IItem<IWordID>null ID for this itempublic java.lang.String getLemma()
IWordnull or empty.
getLemma in interface IWordnull, non-empty root form of this wordpublic POS getPOS()
IHasPOSnull.
getPOS in interface IHasPOSnull if none.public ISynset getSynset()
IWordnull.
getSynset in interface IWordnull synset identified by this word.public int getLexicalID()
IWord
getLexicalID in interface IWordpublic AdjMarker getAdjectiveMarker()
IWordnull
getAdjectiveMarker in interface IWordnull if none.public ISenseKey getSenseKey()
IWordnull;
however, the sense key that is returned may not yet have it's
head lemma and head lexical id set yet, and so may throw an exception on
some calls.
getSenseKey in interface IWordnullISenseKey.needsHeadSet(),
ISenseKey.setHead(String, int)public java.util.Map<IPointer,java.util.List<IWordID>> getRelatedMap()
IWordISynset.getRelatedMap() on the appropriate object.
getRelatedMap in interface IWordpublic java.util.List<IWordID> getRelatedWords(IPointer type)
IWordISynset.getRelatedSynsets(). If this
word has no targets for the for the specified pointer, this method
returns an empty list. This method never returns null.
getRelatedWords in interface IWordtype - the pointer for which related words are requested
public java.util.List<IWordID> getRelatedWords()
IWordISynset.getRelatedSynsets() on the ISynset for this
word.
getRelatedWords in interface IWordpublic java.util.List<IVerbFrame> getVerbFrames()
IWord
getVerbFrames in interface IWordpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic static void checkWordNumber(int num)
IllegalArgumentException if it is not legal.
num - the number to check
java.lang.IllegalArgumentException - if the specified lexical id is not in the closed range [0,15]public static void checkLexicalID(int id)
IllegalArgumentException if it is not legal.
id - the id to check
java.lang.IllegalArgumentException - if the specified lexical id is not in the closed range [0,15]public static boolean isIllegalLexicalID(int id)
id - the lexical id to check
true if the specified integer is an invalid lexical
id; false otherwise.public static boolean isIllegalWordNumber(int num)
num - the number to check
true if the specified integer is an invalid lexical
id; false otherwise.public static java.lang.String getLexicalIDForDataFile(int lexID)
lexID - the lexical id to convert
java.lang.IllegalArgumentException - if the specified integer is not a valid lexical id.public static java.lang.String getLexicalIDForSenseKey(int lexID)
lexID - the lexical id to convert
java.lang.IllegalArgumentException - if the specified integer is not a valid lexical id.public static java.lang.String zeroFillWordNumber(int num)
num - the number to be converted
java.lang.IllegalArgumentException - if the specified number is not a legal word number
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||