Class Synset

All Implemented Interfaces:
Serializable, DictionaryElement
Direct Known Subclasses:
SynsetProxy

public class Synset extends PointerTarget implements DictionaryElement
A Synset, or synonym set, represents a line of a WordNet pos.data file. A Synset represents a concept, and contains a set of Words, each of which has a sense that names that concept (and each of which is therefore synonymous with the other words in the Synset).

Synset's are linked by Pointers into a network of related concepts; this is the Net in WordNet. getTargets retrieves the targets of these links, and getPointers retrieves the pointers themselves.

See Also:
  • Field Details

    • serialVersionUID

      static final long serialVersionUID
      See Also:
    • _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 String _gloss
      The text (definition, usage examples) associated with the synset.
    • _verbFrameFlags

      protected 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 String lexFileName
      The proper name for the lexicographer file (noun.plant, etc)
    • _cachedToString

      private transient String _cachedToString
  • Constructor Details

    • Synset

      public Synset(POS pos, long offset, Word[] words, Pointer[] pointers, String gloss, BitSet verbFrames)
    • Synset

      public Synset(POS pos, long offset, Word[] words, Pointer[] pointers, String gloss, BitSet verbFrames, boolean isAdjectiveCluster)
  • Method Details

    • getType

      public DictionaryElementType getType()
      Description copied from interface: DictionaryElement
      Get the element's type.
      Specified by:
      getType in interface DictionaryElement
    • equals

      public boolean equals(Object object)
      Two Synsets are equal if their POS's and offsets are equal
      Overrides:
      equals in class PointerTarget
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Specified by:
      toString in class PointerTarget
    • getPOS

      public POS getPOS()
      Description copied from class: PointerTarget
      Return this target's POS
      Specified by:
      getPOS in class PointerTarget
    • getPointers

      public Pointer[] getPointers()
      Description copied from class: PointerTarget
      Return a list of Target's pointers
      Specified by:
      getPointers in class PointerTarget
    • getGloss

      public String getGloss()
    • getWords

      public Word[] getWords()
    • getWordsSize

      public int getWordsSize()
    • getWord

      public Word getWord(int index)
    • getOffset

      public long getOffset()
    • getKey

      public Object getKey()
      Description copied from interface: DictionaryElement
      Get a key that can be used to index this element.
      Specified by:
      getKey in interface DictionaryElement
    • isAdjectiveCluster

      public boolean isAdjectiveCluster()
    • getVerbFrames

      public String[] getVerbFrames()
      Returns all Verb Frames that are valid for all the words in this synset
    • getVerbFrameFlags

      public BitSet getVerbFrameFlags()
    • getVerbFrameIndicies

      public int[] getVerbFrameIndicies()
    • containsWord

      public boolean containsWord(String lemma)
      Returns true if lemma is one of the words contained in this synset.
    • readObject

      private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
      Throws:
      IOException
      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 String getLexFileName()
      Gets the lex file name.
      Returns:
    • getSenseKey

      public String getSenseKey(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