|
||||||||||
| 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,
String lemma,
int lexID,
AdjMarker adjMarker,
List<IVerbFrame> frames,
Map<IPointer,? extends List<IWordID>> pointers)
Constructs a new word object. |
|
Word(ISynset synset,
IWordID id,
int lexID,
AdjMarker adjMarker,
List<IVerbFrame> frames,
Map<IPointer,? extends 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(Object obj)
|
AdjMarker |
getAdjectiveMarker()
Returns the adjective marker of this word. |
IWordID |
getID()
Returns the ID object for this item. |
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 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 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. |
Map<IPointer,List<IWordID>> |
getRelatedMap()
Returns an immutable map of from pointers to immutable maps. |
List<IWordID> |
getRelatedWords()
Returns an immutable list of all word ids related to this word by pointers in the database. |
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. |
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]. |
String |
toString()
|
static 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,
String lemma,
int lexID,
AdjMarker adjMarker,
List<IVerbFrame> frames,
Map<IPointer,? extends 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
NullPointerException - if the synset is null
IllegalArgumentException - if the adjective marker is non-null and this is
not an adjective
public Word(ISynset synset,
IWordID id,
int lexID,
AdjMarker adjMarker,
List<IVerbFrame> frames,
Map<IPointer,? extends 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
NullPointerException - if the synset or word ID is null
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 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 Map<IPointer,List<IWordID>> getRelatedMap()
IWordISynset.getRelatedMap() on the appropriate object.
getRelatedMap in interface IWordpublic 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 List<IWordID> getRelatedWords()
IWordISynset.getRelatedSynsets() on the ISynset for this
word.
getRelatedWords in interface IWordpublic List<IVerbFrame> getVerbFrames()
IWord
getVerbFrames in interface IWordpublic String toString()
toString in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic static void checkWordNumber(int num)
IllegalArgumentException if it is not legal.
num - the number to check
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
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 String getLexicalIDForDataFile(int lexID)
lexID - the lexical id to convert
IllegalArgumentException - if the specified integer is not a valid lexical id.public static String getLexicalIDForSenseKey(int lexID)
lexID - the lexical id to convert
IllegalArgumentException - if the specified integer is not a valid lexical id.public static String zeroFillWordNumber(int num)
num - the number to be converted
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 | |||||||||