gov.llnl.ontology.wordnet
Interface Synset

All Known Implementing Classes:
BaseSynset

public interface Synset

This interface represents a single instance of a Synonym Set (Synset for short) from the WordNet dictionary. A Synset is composed of several Lemmas that have a word sense, or meaning, that is the same. Each Synset can be connected to other Synsets through a Synset.Relation. Different Synset.PartsOfSpeech utilize different sets of relations.

A Synset has several key attributes:

All Synsets are stored in memory and are connected as a graph. Any traversal operations should not make the assumption that the graph is acyclic.

Author:
Keith Stevens

Nested Class Summary
static class Synset.PartsOfSpeech
          The set of valid parts of speech encoded by the WordNet dictionary.
static class Synset.Relation
          The set of relations that can connect any two Synsets.
 
Method Summary
 void addDerivationallyRelatedForm(Synset related, RelatedForm form)
          Adds a RelatedForm to this Synset, signifiying that the two Synsets share a Lemma that are closely related.
 void addExample(String example)
          Adds an example sentence detailing how this lemmas for this Synset are used in everday speech.
 void addLemma(Lemma lemma)
          Adds a Lemma to this Synset.
 void addMorphyMapping(String original, String lemma)
           
 boolean addRelation(String relation, Synset related)
          Returns true if a new relation is added between this and related by relation.
 boolean addRelation(Synset.Relation relation, Synset related)
          Returns true if a new relation is added between this and related by relation.
 void addSenseKey(String senseKey)
          Sets the unique sense key string.
 Collection<Synset> allRelations()
          Returns the set of all Synsets that are connected to this Synset, regardless of the relation type.
 Set<String> attributeLabels()
          Returns the set of Attribute keys currently held by this Synset.
 Attribute getAttribute(String attributeName)
          Returns the Attribute associated with the label attributeName applied to this Synset, or null if there is no associated attribute.
 Set<Synset> getChildren()
          Returns the Synsets that are more specific concepts of this Synset.
 String getDefinition()
          Returns the dictionary definition of this Synset
 RelatedForm getDerivationallyRelatedForm(Synset synset)
          Returns a if the provided Synset has a Lemma which is a derivationally related form of a Lemma from this Synset, or null if there is no relation.
 List<String> getExamples()
          Returns the set of example sentences which explain how this Synset is used in regular text.
 int[] getFrameIds()
          Returns the frame indices for all known verb frames for this synset.
 String getGloss()
          Returns the complete gloss, i.e., all definitions and examples.
 int getId()
          Returns the integer identifier used to initially reference this synset within the WordNet dictionary files.
 Set<String> getKnownRelationTypes()
          Returns the set of relation keys that this Synset has with other Synsets.
 int[] getLemmaIds()
          Returns the lemma indices for all known verb frames for this synset.
 List<Lemma> getLemmas()
          Returns the list of Lemmas that correspond to this Synset.
 int getMaxDepth()
          Returns the maximum distance between this Synset and the root Synset.
 int getMinDepth()
          Returns the minimum distance between this Synset and the root Synset.
 String getName()
          Returns a unique string that identifies this Synset.
 int getNumRelations()
          Returns the total number of known relations for this synset.
 List<List<Synset>> getParentPaths()
          Returns a list of all paths from the current Synset to the root of the IS-A hierarchy.
 Set<Synset> getParents()
          Returns the Synsets that are generalized concepts of this Synset.
 Synset.PartsOfSpeech getPartOfSpeech()
          Returns the Synset.PartsOfSpeech attributed to this Synset
 Set<Synset> getRelations(String relation)
          Returns the set of Synsets that are connected to this Synset through the specified relation string.
 Set<Synset> getRelations(Synset.Relation relation)
          Returns the set of Synsets that are connected to this Synset through the specified Synset.Relation.
 String getSenseKey()
          Returns the first unique string that identifies this Synset based on it's part of speech, lexicographer file assignment and index in the lexicographer's file.
 String getSenseKey(String base)
          Returns a unique string that identifies this Synset based on it's part of speech, the base query term, the lexicographer file assignment and index in the lexicographer's file.
 List<String> getSenseKeys()
          Returns all sense keys associated with this Synset.
 int getSenseNumber()
          Returns the sense number for this Synset.
 void merge(Synset other)
          Merges this Synset with the provided Synset.
 boolean removeRelation(String relation, Synset related)
          Returns true if a relation between this and related by the link relation was removed.
 boolean removeRelation(Synset.Relation relation, Synset related)
          Returns true if a relation between this and related by the link relation was removed.
 void setAttribute(String attributeName, Attribute attribute)
          Sets attribute as an object that described this Synset with more detail.
 void setDefinition(String gloss)
          Sets dictionary definition for this Synset.
 void setFrameInfo(int[] frameIds, int[] lemmaIds)
          Sets the indices for frames and lemmas for this synset.
 void setId(int id)
          Sets the id for a given Synset.
 void setSenseNumber(int senseNumber)
          Sets the sense number for this Synset.
 

Method Detail

getId

int getId()
Returns the integer identifier used to initially reference this synset within the WordNet dictionary files. Any Synsets that are added to the dictionary during runtime may return an id of 0. Note that this value is only needed for corpus readers.


setId

void setId(int id)
Sets the id for a given Synset. Only corpus readers need to set this value.


addMorphyMapping

void addMorphyMapping(String original,
                      String lemma)

getName

String getName()
Returns a unique string that identifies this Synset. This name should be based on one of the Synset's lemmas, the part of speech, and the sense number for this Synset. For example, "cat.n.01" signifies that the Synset is a noun and corresponds to the first sense of the "cat" Lemma.


getSenseKey

String getSenseKey()
Returns the first unique string that identifies this Synset based on it's part of speech, lexicographer file assignment and index in the lexicographer's file. This is often the same as the lemma key of the Synset's first Lemma.


getSenseKey

String getSenseKey(String base)
Returns a unique string that identifies this Synset based on it's part of speech, the base query term, the lexicographer file assignment and index in the lexicographer's file. This is often the same as the lemma key of the Synset's first Lemma.


getSenseKeys

List<String> getSenseKeys()
Returns all sense keys associated with this Synset.


addSenseKey

void addSenseKey(String senseKey)
Sets the unique sense key string.


getSenseNumber

int getSenseNumber()
Returns the sense number for this Synset. Sense numbers may be modified whenever a Synset is added, removed, or merged.


setSenseNumber

void setSenseNumber(int senseNumber)
Sets the sense number for this Synset. Sense numbers may be modified whenever a Synset is added, removed, or merged.


getExamples

List<String> getExamples()
Returns the set of example sentences which explain how this Synset is used in regular text.


addExample

void addExample(String example)
Adds an example sentence detailing how this lemmas for this Synset are used in everday speech.


getDefinition

String getDefinition()
Returns the dictionary definition of this Synset


setDefinition

void setDefinition(String gloss)
Sets dictionary definition for this Synset.


getGloss

String getGloss()
Returns the complete gloss, i.e., all definitions and examples.


getLemmas

List<Lemma> getLemmas()
Returns the list of Lemmas that correspond to this Synset.


addLemma

void addLemma(Lemma lemma)
Adds a Lemma to this Synset. Lemmas may be added in order according to their precedence for the Synset.


getFrameIds

int[] getFrameIds()
Returns the frame indices for all known verb frames for this synset.


getLemmaIds

int[] getLemmaIds()
Returns the lemma indices for all known verb frames for this synset.


setFrameInfo

void setFrameInfo(int[] frameIds,
                  int[] lemmaIds)
Sets the indices for frames and lemmas for this synset.


getPartOfSpeech

Synset.PartsOfSpeech getPartOfSpeech()
Returns the Synset.PartsOfSpeech attributed to this Synset


getKnownRelationTypes

Set<String> getKnownRelationTypes()
Returns the set of relation keys that this Synset has with other Synsets. In general these keys will be string versions of Synset.Relations.


allRelations

Collection<Synset> allRelations()
Returns the set of all Synsets that are connected to this Synset, regardless of the relation type.


getRelations

Set<Synset> getRelations(String relation)
Returns the set of Synsets that are connected to this Synset through the specified relation string.


addRelation

boolean addRelation(Synset.Relation relation,
                    Synset related)
Returns true if a new relation is added between this and related by relation. Returning false signifies that the relation already exists.


addRelation

boolean addRelation(String relation,
                    Synset related)
Returns true if a new relation is added between this and related by relation. Returning false signifies that the relation already exists.


getRelations

Set<Synset> getRelations(Synset.Relation relation)
Returns the set of Synsets that are connected to this Synset through the specified Synset.Relation.


removeRelation

boolean removeRelation(Synset.Relation relation,
                       Synset related)
Returns true if a relation between this and related by the link relation was removed. Returning false signifies that there was no link to remove.


removeRelation

boolean removeRelation(String relation,
                       Synset related)
Returns true if a relation between this and related by the link relation was removed. Returning false signifies that there was no link to remove.


getNumRelations

int getNumRelations()
Returns the total number of known relations for this synset.


getDerivationallyRelatedForm

RelatedForm getDerivationallyRelatedForm(Synset synset)
Returns a if the provided Synset has a Lemma which is a derivationally related form of a Lemma from this Synset, or null if there is no relation.


addDerivationallyRelatedForm

void addDerivationallyRelatedForm(Synset related,
                                  RelatedForm form)
Adds a RelatedForm to this Synset, signifiying that the two Synsets share a Lemma that are closely related.


getParents

Set<Synset> getParents()
Returns the Synsets that are generalized concepts of this Synset. This is equivalent to calling getRelations() with Relation:HYPERNYM.


getParentPaths

List<List<Synset>> getParentPaths()
Returns a list of all paths from the current Synset to the root of the IS-A hierarchy. Since every Synset can have multiple parents, there may be multiple paths that have several commond Synsets. The parent paths will begin a the Synset that is furthest from this Synset and end with this Synset.


getChildren

Set<Synset> getChildren()
Returns the Synsets that are more specific concepts of this Synset. This is equivalent to calling getRelations() with Relation:HYPONYM.


getMaxDepth

int getMaxDepth()
Returns the maximum distance between this Synset and the root Synset.


getMinDepth

int getMinDepth()
Returns the minimum distance between this Synset and the root Synset.


setAttribute

void setAttribute(String attributeName,
                  Attribute attribute)
Sets attribute as an object that described this Synset with more detail. attributeName is a label for the provided attribute.


getAttribute

Attribute getAttribute(String attributeName)
Returns the Attribute associated with the label attributeName applied to this Synset, or null if there is no associated attribute.


attributeLabels

Set<String> attributeLabels()
Returns the set of Attribute keys currently held by this Synset.


merge

void merge(Synset other)
Merges this Synset with the provided Synset.



Copyright © 2010-2011. All Rights Reserved.