Package net.didion.jwnl.data
Class Synset
- java.lang.Object
-
- net.didion.jwnl.data.PointerTarget
-
- net.didion.jwnl.data.Synset
-
- All Implemented Interfaces:
java.io.Serializable,DictionaryElement
- Direct Known Subclasses:
SynsetProxy
public class Synset extends PointerTarget implements DictionaryElement
ASynset, or synonym set, represents a line of a WordNet pos.datafile. ASynsetrepresents a concept, and contains a set ofWords, each of which has a sense that names that concept (and each of which is therefore synonymous with the other words in theSynset).Synset's are linked byPointers into a network of related concepts; this is theNet in WordNet.getTargetsretrieves the targets of these links, andgetPointersretrieves the pointers themselves.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String_cachedToStringprotected java.lang.String_glossThe text (definition, usage examples) associated with the synset.protected boolean_isAdjectiveClusterfor use only with WordNet 1.6 and earlierprotected long_offsetThe offset of this synset in the data file.protected Pointer[]_pointersprotected POS_posprotected java.util.BitSet_verbFrameFlagsprotected Word[]_wordsThe words in this synset.protected java.lang.StringlexFileNameThe proper name for the lexicographer file (noun.plant, etc)protected longlexFileNumThe lexicographer file name id.(package private) static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description Synset(POS pos, long offset, Word[] words, Pointer[] pointers, java.lang.String gloss, java.util.BitSet verbFrames)Synset(POS pos, long offset, Word[] words, Pointer[] pointers, java.lang.String gloss, java.util.BitSet verbFrames, boolean isAdjectiveCluster)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsWord(java.lang.String lemma)Returns true iflemmais one of the words contained in this synset.booleanequals(java.lang.Object object)Two Synsets are equal if their POS's and offsets are equaljava.lang.StringgetGloss()java.lang.ObjectgetKey()Get a key that can be used to index this element.java.lang.StringgetLexFileName()Gets the lex file name.longgetLexFileNum()Gets the lexicographer file name containing this synset.longgetOffset()Pointer[]getPointers()Return a list of Target's pointersPOSgetPOS()Return this target's POSjava.lang.StringgetSenseKey(java.lang.String lemma)Gets the sense key of a lemma.DictionaryElementTypegetType()Get the element's type.java.util.BitSetgetVerbFrameFlags()int[]getVerbFrameIndicies()java.lang.String[]getVerbFrames()Returns all Verb Frames that are valid for all the words in this synsetWordgetWord(int index)Word[]getWords()intgetWordsSize()inthashCode()booleanisAdjectiveCluster()private voidreadObject(java.io.ObjectInputStream in)voidsetLexFileNum(long lexFileId)Sets the lexicographer file name containing this synset.java.lang.StringtoString()-
Methods inherited from class net.didion.jwnl.data.PointerTarget
getPointers, getTargets, getTargets
-
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
- See Also:
- Constant Field Values
-
_pos
protected POS _pos
-
_pointers
protected Pointer[] _pointers
-
_offset
protected long _offset
The offset of this synset in the data file.
-
_words
protected Word[] _words
The words in this synset.
-
_gloss
protected java.lang.String _gloss
The text (definition, usage examples) associated with the synset.
-
_verbFrameFlags
protected java.util.BitSet _verbFrameFlags
-
_isAdjectiveCluster
protected boolean _isAdjectiveCluster
for use only with WordNet 1.6 and earlier
-
lexFileNum
protected long lexFileNum
The lexicographer file name id.
-
lexFileName
protected java.lang.String lexFileName
The proper name for the lexicographer file (noun.plant, etc)
-
_cachedToString
private transient java.lang.String _cachedToString
-
-
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)
Two Synsets are equal if their POS's and offsets are equal- Overrides:
equalsin classPointerTarget
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Specified by:
toStringin classPointerTarget
-
getPOS
public POS getPOS()
Description copied from class:PointerTargetReturn this target's POS- Specified by:
getPOSin classPointerTarget
-
getPointers
public Pointer[] getPointers()
Description copied from class:PointerTargetReturn a list of Target's pointers- Specified by:
getPointersin classPointerTarget
-
getGloss
public java.lang.String getGloss()
-
getWords
public Word[] getWords()
-
getWordsSize
public int getWordsSize()
-
getWord
public Word getWord(int index)
-
getOffset
public long getOffset()
-
getKey
public java.lang.Object getKey()
Description copied from interface:DictionaryElementGet a key that can be used to index this element.- Specified by:
getKeyin interfaceDictionaryElement
-
isAdjectiveCluster
public boolean isAdjectiveCluster()
-
getVerbFrames
public java.lang.String[] getVerbFrames()
Returns all Verb Frames that are valid for all the words in this synset
-
getVerbFrameFlags
public java.util.BitSet getVerbFrameFlags()
-
getVerbFrameIndicies
public int[] getVerbFrameIndicies()
-
containsWord
public boolean containsWord(java.lang.String lemma)
Returns true iflemmais one of the words contained in this synset.
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
getLexFileNum
public long getLexFileNum()
Gets the lexicographer file name containing this synset.- Returns:
- two digit decimal integer
-
setLexFileNum
public void setLexFileNum(long lexFileId)
Sets the lexicographer file name containing this synset.- Parameters:
lexFileId- - the lexicographer file name id
-
getLexFileName
public java.lang.String getLexFileName()
Gets the lex file name.- Returns:
-
getSenseKey
public java.lang.String getSenseKey(java.lang.String lemma)
Gets the sense key of a lemma. This will be refactored in 2.0 with the architecture reworking.- Parameters:
lemma- lemma sense to grab- Returns:
- sense key for lemma
-
-