Package net.didion.jwnl.data
Class IndexWord
- java.lang.Object
-
- net.didion.jwnl.data.IndexWord
-
- All Implemented Interfaces:
java.io.Serializable,DictionaryElement
public class IndexWord extends java.lang.Object implements DictionaryElement
AnIndexWordrepresents a line of the pos.indexfile. AnIndexWordis created or retrieved vialookupIndexWord.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String_cachedToStringprivate java.lang.String_lemmaThe string representation of this IndexWordprivate POS_posThis word's part-of-speechprivate long[]_synsetOffsetssenses are initially stored as offsets, and paged in on demand.private Synset[]_synsetsThis is null until getSenses has been called.private boolean_synsetsLoadedTrue when all synsets have been loaded(package private) static longserialVersionUID
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object object)Returns true if the lemma and the part of speech both match.java.lang.ObjectgetKey()Gets the lemma of this word.java.lang.StringgetLemma()Return the word'slemma .POSgetPOS()Get the word's part-of-speech.SynsetgetSense(int index)Get a particular sense of this word.intgetSenseCount()Get the word's sense count.Synset[]getSenses()Get an array of all the senses of this word.long[]getSynsetOffsets()DictionaryElementTypegetType()Get the element's type.inthashCode()private voidloadSynset(int i)private voidreadObject(java.io.ObjectInputStream in)java.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
- See Also:
- Constant Field Values
-
_pos
private POS _pos
This word's part-of-speech
-
_lemma
private java.lang.String _lemma
The string representation of this IndexWord
-
_synsetOffsets
private long[] _synsetOffsets
senses are initially stored as offsets, and paged in on demand.
-
_synsets
private transient Synset[] _synsets
This is null until getSenses has been called.
-
_synsetsLoaded
private transient boolean _synsetsLoaded
True when all synsets have been loaded
-
_cachedToString
private transient java.lang.String _cachedToString
-
-
Constructor Detail
-
IndexWord
public IndexWord(java.lang.String lemma, POS pos, long[] synsetOffsets)
-
-
Method Detail
-
getType
public DictionaryElementType getType()
Description copied from interface:DictionaryElementGet the element's type.- Specified by:
getTypein interfaceDictionaryElement
-
equals
public boolean equals(java.lang.Object object)
Returns true if the lemma and the part of speech both match.- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getPOS
public POS getPOS()
Get the word's part-of-speech.
-
getLemma
public java.lang.String getLemma()
Return the word'slemma . Its lemma is its orthographic representation, for example"dog"or"get up".
-
getSynsetOffsets
public long[] getSynsetOffsets()
-
getKey
public java.lang.Object getKey()
Gets the lemma of this word.- Specified by:
getKeyin interfaceDictionaryElement- Returns:
- lemma
-
getSenseCount
public int getSenseCount()
Get the word's sense count.
-
getSenses
public Synset[] getSenses() throws JWNLException
Get an array of all the senses of this word.- Throws:
JWNLException
-
getSense
public Synset getSense(int index) throws JWNLException
Get a particular sense of this word. Sense indices start at 1.- Throws:
JWNLException
-
loadSynset
private void loadSynset(int i) throws JWNLException- Throws:
JWNLException
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-