edu.mit.jwi.item
Class Synset

java.lang.Object
  extended by edu.mit.jwi.item.Synset
All Implemented Interfaces:
IHasPOS, IItem<ISynsetID>, ISynset

public class Synset
extends java.lang.Object
implements ISynset

Default implementation of the ISynset interface.

Since:
1.5.0
Version:
2.1.5, Nov. 16, 2007
Author:
Mark A. Finlayson

Constructor Summary
Synset(ISynsetID id, ILexFile lexFile, boolean isAdjSat, boolean isAdjHead, java.lang.String gloss, java.util.List<IWord> words, java.util.Map<IPointer,? extends java.util.List<ISynsetID>> ids)
           
 
Method Summary
static void checkOffset(int offset)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getGloss()
          The gloss (brief, plain-English description) of this synset.
 ISynsetID getID()
          Returns the ID object.
 ILexFile getLexicalFile()
          Returns a representation of the lexical file.
 int getOffset()
          Returns the data file offset of this synset, per the Wordnet specification.
 POS getPOS()
          Returns which part of speech this object pertains to.
 java.util.Map<IPointer,java.util.List<ISynsetID>> getRelatedMap()
          Returns an immutable map from pointers to immutable lists of synsets Note that this only returns a non-empty result for semantic pointers (i.e., non-lexical pointers).
 java.util.List<ISynsetID> getRelatedSynsets()
          Returns an immutable list of synset ids for all synsets that are connected by pointers to this synset.
 java.util.List<ISynsetID> getRelatedSynsets(IPointer type)
          Returns an immutable list of the ids of all synsets that are related to this synset by the specified pointer type.
 int getType()
          Returns the type of the synset, encoded as follows: 1=Noun, 2=Verb, 3=Adjective, 4=Adverb, 5=Adjective Satellite.
 IWord getWord(int wordNumber)
          Returns the word with the specified word number.
 java.util.List<IWord> getWords()
          Returns an immutable list of the word objects (synset, index word pairs) associated with this synset.
 int hashCode()
           
 boolean isAdjectiveHead()
          Returns whether this synset is an adjective head or not, per Wordnet specification.
 boolean isAdjectiveSatellite()
          Returns whether this synset is an adjective satellite or not, per Wordnet specification.
static boolean isIllegalOffset(int offset)
           
 java.lang.String toString()
           
static java.lang.String zeroFillOffset(int offset)
          Takes an integer in the closed range [0,99999999] and converts it into an eight decimal digit zero-filled string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Synset

public Synset(ISynsetID id,
              ILexFile lexFile,
              boolean isAdjSat,
              boolean isAdjHead,
              java.lang.String gloss,
              java.util.List<IWord> words,
              java.util.Map<IPointer,? extends java.util.List<ISynsetID>> ids)
Throws:
java.lang.NullPointerException - if any argument is null
Method Detail

getID

public ISynsetID getID()
Description copied from interface: IItem
Returns the ID object.

Specified by:
getID in interface IItem<ISynsetID>
Returns:
T The ID object

getOffset

public int getOffset()
Description copied from interface: ISynset
Returns the data file offset of this synset, per the Wordnet specification.

Specified by:
getOffset in interface ISynset
Returns:
int the offset in the associated data source

getPOS

public POS getPOS()
Description copied from interface: IHasPOS
Returns which part of speech this object pertains to. May be null, if the object is not specific to any particular part of speech.

Specified by:
getPOS in interface IHasPOS

getType

public int getType()
Description copied from interface: ISynset
Returns the type of the synset, encoded as follows: 1=Noun, 2=Verb, 3=Adjective, 4=Adverb, 5=Adjective Satellite.

Specified by:
getType in interface ISynset

getGloss

public java.lang.String getGloss()
Description copied from interface: ISynset
The gloss (brief, plain-English description) of this synset.

Specified by:
getGloss in interface ISynset
Returns:
String The gloss

getWords

public java.util.List<IWord> getWords()
Description copied from interface: ISynset
Returns an immutable list of the word objects (synset, index word pairs) associated with this synset.

Specified by:
getWords in interface ISynset

getWord

public IWord getWord(int wordNumber)
Description copied from interface: ISynset
Returns the word with the specified word number. Words are numbered sequentially from 1 up to, and including 255.

Specified by:
getWord in interface ISynset

getRelatedMap

public java.util.Map<IPointer,java.util.List<ISynsetID>> getRelatedMap()
Description copied from interface: ISynset
Returns an immutable map from pointers to immutable lists of synsets Note that this only returns a non-empty result for semantic pointers (i.e., non-lexical pointers). To obtain lexical pointers, call IWord.getRelatedMap() on the appropriate object.

Specified by:
getRelatedMap in interface ISynset

getRelatedSynsets

public java.util.List<ISynsetID> getRelatedSynsets(IPointer type)
Description copied from interface: ISynset
Returns an immutable list of the ids of all synsets that are related to this synset by the specified pointer type. Note that this only returns a non-empty result for semantic pointers (i.e., non-lexical pointers). To obtain lexical pointers, call IWord.getRelatedWords()() on the appropriate object.

Specified by:
getRelatedSynsets in interface ISynset

getRelatedSynsets

public java.util.List<ISynsetID> getRelatedSynsets()
Description copied from interface: ISynset
Returns an immutable list of synset ids for all synsets that are connected by pointers to this synset. Note that the related synsets returned by this call are related by semantic pointers (as opposed to lexical pointers, which are relationships between IWord objects.

Specified by:
getRelatedSynsets in interface ISynset

isAdjectiveSatellite

public boolean isAdjectiveSatellite()
Description copied from interface: ISynset
Returns whether this synset is an adjective satellite or not, per Wordnet specification.

Specified by:
isAdjectiveSatellite in interface ISynset

isAdjectiveHead

public boolean isAdjectiveHead()
Description copied from interface: ISynset
Returns whether this synset is an adjective head or not, per Wordnet specification.

Specified by:
isAdjectiveHead in interface ISynset

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getLexicalFile

public ILexFile getLexicalFile()
Description copied from interface: ISynset
Returns a representation of the lexical file. In wordnet data files, the lexical file number is a two digit decimal integer representing the name of the lexicographer file containing the synset for the sense.

Specified by:
getLexicalFile in interface ISynset

zeroFillOffset

public static java.lang.String zeroFillOffset(int offset)
Takes an integer in the closed range [0,99999999] and converts it into an eight decimal digit zero-filled string. E.g., "1" becomes "00000001", "1234" becomes "00001234", and so on. This is used for the generation of Synset and Word ID numbers.


checkOffset

public static void checkOffset(int offset)

isIllegalOffset

public static boolean isIllegalOffset(int offset)
Returns:
true if the specified offset is in the closed range [0, 99999999]; false otherwise.


Copyright © 2007-2008 Massachusetts Institute of Technology. All Rights Reserved.