|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.tuebingen.uni.sfs.germanet.api.Synset
public class Synset
A Synset
belongs to a WordCategory
(WordCategory.adj
, WordCategory.nomen
,
WordCategory.verben
) and
consists of a paraphrase (Strings) and a list of LexUnit
s.
The List of LexUnits is never empty.
A Synset
also has the conceptual relations (ConRel
),
of which hypernymy, hyponymy, meronymy, and holonymy
are transitive:
ConRel.has_hypernym
, ConRel.has_hyponym
,
ConRel.has_component_meronym
, ConRel.has_component_holonym
,
ConRel.has_member_meronym
, ConRel.has_member_holonym
,
ConRel.has_substance_meronym
, ConRel.has_substance_holonym
,
ConRel.has_portion_meronym
, ConRel.has_portion_holonym
,
ConRel.entails
, ConRel.is_entailed_by
,
ConRel.is_related_to
,
ConRel.causes
Methods are provided to get the WordCategory
, paraphrase, and
the LexUnit
s.
Conceptual relations can be retrieved:
List<Synset> hypernyms = aSynset.getRelatedLexUnits(ConRel.has_hypernym);
Transitive relations can be retrieved:
List<List<Synset>> meronyms = aSynset.getTransRelatedSynsets(ConRel.meronymy);
which returns a List of Lists, each representing the Synsets found at a depth.
Neighbors (all Synsets that are related to this one) can be retrieved:
List<Synset> neighbors = aSynset.getRelatedLexUnits();
Unless otherwise stated, methods will return an empty List rather than null
to indicate that no objects exist for the given request.
Constructor Summary | |
---|---|
protected |
Synset(int id,
WordCategory wordCategory,
WordClass wordClass)
Constructs a Synset with the specified attributes. |
Method Summary | |
---|---|
protected void |
addLexUnit(LexUnit lexUnit)
Adds a LexUnit to this Synset . |
protected void |
addRelation(ConRel type,
Synset target)
Add a relation of the specified type to target Synset . |
int |
compareTo(java.lang.Object otherSynset)
Return 1 if this Synset has a larger id than another Synset ,
-1 if it has a smaller one. |
boolean |
equals(Synset other)
Return true if this Synset is equal to another Synset . |
java.util.List<java.lang.String> |
getAllOrthForms()
Returns a List of all (old) orthographic forms and variants
contained in all LexUnits of this Synset . |
int |
getId()
Return the unique identifier for this Synset . |
java.util.List<IliRecord> |
getIliRecords()
Returns a List of all of the IliRecords that this
Synset is associated with. |
java.util.List<LexUnit> |
getLexUnits()
Returns a List of this Synset 's
LexUnits . |
java.lang.String |
getParaphrase()
Returns this Synset 's paraphrase (can be empty). |
java.util.List<java.lang.String> |
getParaphrases()
Returns this Synset 's paraphrases (can be empty). |
java.util.List<Synset> |
getRelatedSynsets()
Returns a List of all of the Synsets that this
Synset has any relation to. |
java.util.List<Synset> |
getRelatedSynsets(ConRel type)
Returns a List of this Synset 's relations of
type type . |
java.util.List<java.util.List<Synset>> |
getTransRelatedSynsets(ConRel type)
Returns the transitive closure of all relations of type type
to this Synset . |
WordCategory |
getWordCategory()
Returns the WordCategory that this Synset belongs to. |
WordClass |
getWordClass()
Returns the WordClass that this Synset belongs to. |
boolean |
inWordCategory(WordCategory wordCategory)
Return true if this Synset is in wordCategory . |
boolean |
inWordClass(WordClass wordClass)
Return true if this Synset is in wordClass . |
int |
numLexUnits()
Return the number of LexUnits in this Synset . |
protected void |
setParaphrase(java.lang.String paraphrase)
Sets the paraphrase of this Synset . |
protected void |
setWordClass(WordClass wordClass)
Sets the word class of this Synset . |
java.lang.String |
toString()
Returns a String representation of this Synset . |
protected void |
trimAll()
Trims all ArrayLists to conserve memory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected Synset(int id, WordCategory wordCategory, WordClass wordClass)
Synset
with the specified attributes.
id
- unique identifierwordCategory
- the WordCategory
of this Synset
wordClass
- the WordClass
of this Synset
Method Detail |
---|
public WordCategory getWordCategory()
WordCategory
that this Synset
belongs to.
WordCategory
that this Synset
belongs topublic WordClass getWordClass()
WordClass
that this Synset
belongs to.
WordClass
that this Synset
belongs topublic boolean inWordCategory(WordCategory wordCategory)
Synset
is in wordCategory
.
wordCategory
- the WordCategory
(eg. nomen, verben, adj)
Synset
is in wordCategory
public boolean inWordClass(WordClass wordClass)
Synset
is in wordClass
.
wordClass
- the WordClass
Synset
is in wordClass
public int numLexUnits()
LexUnits
in this Synset
.
LexUnits
in this Synset
public int getId()
Synset
.
Synset
as it appears
in the data files.protected void addLexUnit(LexUnit lexUnit)
LexUnit
to this Synset
.
lexUnit
- the LexUnit
to add.protected void setParaphrase(java.lang.String paraphrase)
Synset
.
paraphrase
- the paraphrase to set for this Synset
protected void setWordClass(WordClass wordClass)
Synset
.
wordClass
- the word class to set for this Synset
protected void trimAll()
ArrayLists
to conserve memory.
public java.util.List<LexUnit> getLexUnits()
List
of this Synset
's
LexUnits
. This List
is never empty.
List
of this Synset
's
LexUnits
public java.util.List<java.lang.String> getAllOrthForms()
List
of all (old) orthographic forms and variants
contained in all LexUnits
of this Synset
.
This List
is never empty as the List
of
LexUnits
is never empty.
List
of all orthographic forms contained in all
LexUnits
of this Synset
public java.lang.String getParaphrase()
Synset
's paraphrase (can be empty). This is the
paraphrase that was manually added to GermaNet.
Synset
's paraphrasepublic java.util.List<java.lang.String> getParaphrases()
Synset
's paraphrases (can be empty). This list
contains all paraphrases that were harvested from Wiktionary (this
requires a call of GermaNet.loadWiktionaryParaphrases
before) as well as GermaNet's manually added paraphrase.
Synset
's paraphrasesprotected void addRelation(ConRel type, Synset target)
Synset
.
type
- the type of relation (eg. ConRel.has_hypernym
)target
- the target Synset
public java.util.List<Synset> getRelatedSynsets(ConRel type)
List
of this Synset
's relations of
type type
.
type
- type of relations to retrieve
List
of this Synset
's relations of
type type
For example, hypernyms of this Synset
can be retrieved with
the type ConRel.has_hypernym
public java.util.List<java.util.List<Synset>> getTransRelatedSynsets(ConRel type)
type
to this Synset
. A List
of Lists
of
Synsets
is returned, where the List
at
position 0 contains this Synset
, the List
at
position 1 contains the relations at depth 1, the List
at
position 2 contains the relations at depth 2, and so on up to the maximum
depth. The size of the List
returned indicates the maximum
depth.List
if type is not transitive.
type
- the type
of relation (e.g.
ConRel.has_hypernym
).
type
- a List
of Lists
of Synsets
public java.util.List<Synset> getRelatedSynsets()
List
of all of the Synsets
that this
Synset
has any relation to.
List
of all of the Synsets
that this
Synset
has any relation topublic java.lang.String toString()
String
representation of this Synset
.
toString
in class java.lang.Object
String
representation of this Synset
public java.util.List<IliRecord> getIliRecords()
List
of all of the IliRecords
that this
Synset
is associated with.
List
of all of the IliRecords
that this
Synset
is associated withpublic boolean equals(Synset other)
Synset
is equal to another Synset
.
other
- the Synset
to compare to
Synset
is equal to another Synset
public int compareTo(java.lang.Object otherSynset)
Synset
has a larger id than another Synset
,
-1 if it has a smaller one.
compareTo
in interface java.lang.Comparable
otherSynset
- the Synset
to compare to
Synset
is equal to another Synset
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |