|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.llnl.ontology.wordnet.BaseSynset
public class BaseSynset
The core Synset
implementation when interfacing directly with the
word net dictionary files. This implementation satisfies all of the
requirements of a Synset
and allows the Synset
to be
re-serialized in the proper word net form.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface gov.llnl.ontology.wordnet.Synset |
---|
Synset.PartsOfSpeech, Synset.Relation |
Constructor Summary | |
---|---|
BaseSynset(int offset,
Synset.PartsOfSpeech pos)
Creates a BaseSynset with a byte offset value. |
|
BaseSynset(String synsetName)
Creates a BaseSynset with a byte offset value. |
|
BaseSynset(Synset.PartsOfSpeech pos)
Creates an empty BaseSynset . |
Method Summary | |
---|---|
void |
addDerivationallyRelatedForm(Synset related,
RelatedForm form)
Adds a RelatedForm to this Synset , signifiying that the
two Synset s 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 synset)
Returns true if a new relation is added between this and
related by relation . |
boolean |
addRelation(Synset.Relation relation,
Synset synset)
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 Synset s 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 Synset s 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
Synset s. |
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 Synset s 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 Synset s that are connected to this Synset through the specified relation string. |
Set<Synset> |
getRelations(Synset.Relation relation)
Returns the set of Synset s 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 synset)
Merges this Synset with the provided Synset . |
boolean |
removeRelation(String relation,
Synset synset)
Returns true if a relation between this and related by the link relation was removed. |
boolean |
removeRelation(Synset.Relation relation,
Synset synset)
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 definition)
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 newOffset)
Sets the id for a given Synset . |
void |
setSenseNumber(int senseNumber)
Sets the sense number for this Synset . |
String |
toString()
Returns this Synset s name and gloss. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BaseSynset(String synsetName)
BaseSynset
with a byte offset value.
public BaseSynset(int offset, Synset.PartsOfSpeech pos)
BaseSynset
with a byte offset value.
public BaseSynset(Synset.PartsOfSpeech pos)
BaseSynset
.
Method Detail |
---|
public void addMorphyMapping(String original, String lemma)
addMorphyMapping
in interface Synset
public int getSenseNumber()
Synset
. Sense numbers may be
modified whenever a Synset
is added, removed, or merged.
getSenseNumber
in interface Synset
public void setSenseNumber(int senseNumber)
Synset
. Sense numbers may be
modified whenever a Synset
is added, removed, or merged.
setSenseNumber
in interface Synset
public String getName()
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
.
getName
in interface Synset
public String getSenseKey()
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
in interface Synset
public String getSenseKey(String base)
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
.
getSenseKey
in interface Synset
public List<String> getSenseKeys()
Synset
.
getSenseKeys
in interface Synset
public void addSenseKey(String senseKey)
addSenseKey
in interface Synset
public String getDefinition()
Synset
getDefinition
in interface Synset
public Synset.PartsOfSpeech getPartOfSpeech()
Synset.PartsOfSpeech
attributed to this Synset
getPartOfSpeech
in interface Synset
public List<Lemma> getLemmas()
Lemmas
that correspond to this Synset
.
getLemmas
in interface Synset
public List<String> getExamples()
Synset
is used in regular text.
getExamples
in interface Synset
public RelatedForm getDerivationallyRelatedForm(Synset synset)
Synset
has a Lemma
which is a derivationally related form of a Lemma
from
this Synset
, or null
if there is no relation.
getDerivationallyRelatedForm
in interface Synset
public Set<String> getKnownRelationTypes()
Synset
has with other
Synset
s. In general these keys will be string versions of Synset.Relation
s.
getKnownRelationTypes
in interface Synset
public Collection<Synset> allRelations()
Synset
s that are connected to this Synset
, regardless of the relation type.
allRelations
in interface Synset
public Set<Synset> getRelations(String relation)
Synset
s that are connected to this Synset
through the specified relation
string.
getRelations
in interface Synset
public Set<Synset> getRelations(Synset.Relation relation)
Synset
s that are connected to this Synset
through the specified Synset.Relation
.
getRelations
in interface Synset
public int getNumRelations()
getNumRelations
in interface Synset
public List<List<Synset>> getParentPaths()
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 Synset
s. The parent paths will begin a the Synset
that is
furthest from this Synset
and end with this Synset
.
getParentPaths
in interface Synset
public Set<Synset> getParents()
Synset
s that are generalized concepts of this Synset
. This is equivalent to calling getRelations()
with
Relation:HYPERNYM
.
getParents
in interface Synset
public Set<Synset> getChildren()
Synset
s that are more specific concepts of this
Synset
. This is equivalent to calling getRelations()
with Relation:HYPONYM
.
getChildren
in interface Synset
public int getId()
Synset
s that are added
to the dictionary during runtime may return an id of 0. Note that this
value is only needed for corpus readers.
getId
in interface Synset
public int[] getFrameIds()
getFrameIds
in interface Synset
public int[] getLemmaIds()
getLemmaIds
in interface Synset
public void setFrameInfo(int[] frameIds, int[] lemmaIds)
setFrameInfo
in interface Synset
public void setId(int newOffset)
Synset
. Only corpus readers need to set
this value.
setId
in interface Synset
public void setDefinition(String definition)
Synset
.
setDefinition
in interface Synset
public void addLemma(Lemma lemma)
Lemma
to this Synset
. Lemma
s may be
added in order according to their precedence for the Synset
.
addLemma
in interface Synset
public void addExample(String example)
Synset
are used in everday speech.
addExample
in interface Synset
public void addDerivationallyRelatedForm(Synset related, RelatedForm form)
RelatedForm
to this Synset
, signifiying that the
two Synset
s share a Lemma
that are closely related.
addDerivationallyRelatedForm
in interface Synset
public boolean addRelation(Synset.Relation relation, Synset synset)
true
if a new relation is added between this
and
related
by relation
. Returning false
signifies
that the relation already exists.
addRelation
in interface Synset
public boolean addRelation(String relation, Synset synset)
true
if a new relation is added between this
and
related
by relation
. Returning false
signifies
that the relation already exists.
addRelation
in interface Synset
public boolean removeRelation(Synset.Relation relation, Synset synset)
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
in interface Synset
public boolean removeRelation(String relation, Synset synset)
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
in interface Synset
public String getGloss()
getGloss
in interface Synset
public int getMaxDepth()
Synset
and the root
Synset
.
getMaxDepth
in interface Synset
public int getMinDepth()
Synset
and the root
Synset
.
getMinDepth
in interface Synset
public void setAttribute(String attributeName, Attribute attribute)
attribute
as an object that described this Synset
with more detail. attributeName
is a label for the provided
attribute
.
setAttribute
in interface Synset
public Attribute getAttribute(String attributeName)
Attribute
associated with the label attributeName
applied to this Synset
, or null
if there
is no associated attribute.
getAttribute
in interface Synset
public Set<String> attributeLabels()
Attribute
keys currently held by this Synset
.
attributeLabels
in interface Synset
public void merge(Synset synset)
Synset
with the provided Synset
.
merge
in interface Synset
public String toString()
Synset
s name and gloss.
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |