|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.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 null
number
- 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 adjectivepublic 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 null
lexID
- 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 adjectiveMethod Detail |
---|
public IWordID getID()
IItem
null
.
getID
in interface IItem<IWordID>
null
ID for this itempublic java.lang.String getLemma()
IWord
null
or empty.
getLemma
in interface IWord
null
, non-empty root form of this wordpublic POS getPOS()
IHasPOS
null
.
getPOS
in interface IHasPOS
null
if none.public ISynset getSynset()
IWord
null
.
getSynset
in interface IWord
null
synset identified by this word.public int getLexicalID()
IWord
getLexicalID
in interface IWord
public AdjMarker getAdjectiveMarker()
IWord
null
getAdjectiveMarker
in interface IWord
null
if none.public ISenseKey getSenseKey()
IWord
null
;
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 IWord
null
ISenseKey.needsHeadSet()
,
ISenseKey.setHead(String, int)
public java.util.Map<IPointer,java.util.List<IWordID>> getRelatedMap()
IWord
ISynset.getRelatedMap()
on the appropriate object.
getRelatedMap
in interface IWord
public java.util.List<IWordID> getRelatedWords(IPointer type)
IWord
ISynset.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 IWord
type
- the pointer for which related words are requested
public java.util.List<IWordID> getRelatedWords()
IWord
ISynset.getRelatedSynsets()
on the ISynset
for this
word.
getRelatedWords
in interface IWord
public java.util.List<IVerbFrame> getVerbFrames()
IWord
getVerbFrames
in interface IWord
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public 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 |