de.tuebingen.uni.sfs.germanet.api
Class LexUnit

java.lang.Object
  extended by de.tuebingen.uni.sfs.germanet.api.LexUnit

public class LexUnit
extends java.lang.Object

A LexUnit consists of an orthForm (represented as a String), an orthVar (can be empty), an oldOrthForm (can be empty), and an oldOrthVar (can be empty). Examples, Frames, IliRecords, and WiktionaryParaphrases can belong to a LexUnit as well as the following attributes: styleMarking (boolean), sense (int), styleMarking (boolean), artificial (boolean), namedEntity (boolean), and source (String).
A LexUnit also has the lexical relations:

LexRel.has_antonym, LexRel.has_synonym, LexRel.has_pertainym, LexRel.has_participle

Methods are provided to get each of the attributes.

The orthographic form can be retrieved:
   String orthForm = aLexUnit.getOrthForm();

The orthographic form, and (if existent) the orthographic variant, the old orthographic form, and the old orthographic variant can be retrieved at once:
   List<String> forms = aLexUnit.getAllOrthForms();

Lexical relations can be retrieved:
   List<LexUnit> antonyms = aLexUnit.getRelatedLexUnits(LexRel.antonymy);

Neighbors (all LexUnits that are related to this one) can be retrieved:
   List<LexUnit> neighbors = aLexUnit.getRelatedLexUnits();

Unless otherwise stated, methods will return an empty List rather than null to indicate that no objects exist for the given request.


Method Summary
protected  void addExample(Example example)
          Adds an Example to this Synset.
protected  void addFrame(Frame frame)
          Adds a Frame to this Synset.
protected  void addIliRecord(IliRecord record)
          Add an IliRecord to this LexUnit.
protected  void addRelation(LexRel type, LexUnit target)
          Adds a relation of the specified type to the target LexUnit.
 void addWiktionaryParaphrase(WiktionaryParaphrase paraphrase)
          Add a WiktionaryParaphrase to this LexUnit.
 boolean equals(LexUnit other)
          Return true if this LexUnit is equal to another LexUnit.
 java.util.List<Example> getExamples()
          Returns a List of this LexUnit's Examples/code>.
 java.util.List<Frame> getFrames()
          Returns a List of this LexUnit's Frames.
 int getId()
          Returns the unique identifier of this LexUnit.
 java.util.List<IliRecord> getIliRecords()
          Return a List of IliRecords for this LexUnit.
 java.lang.String getOldOrthForm()
          Returns the old orthographic form of this LexUnit.
 java.lang.String getOldOrthVar()
          Returns the old orthographic variant of this LexUnit.
 java.lang.String getOrthForm()
          Returns the orthographic form of this LexUnit.
 java.util.List<java.lang.String> getOrthForms()
          Returns a List of all orthographic forms of this LexUnit (i.e.
 java.lang.String getOrthVar()
          Returns the orthographic variant of this LexUnit.
 java.util.List<LexUnit> getRelatedLexUnits()
          Returns a List of all of the LexUnits that this LexUnit has any relation to.
 java.util.List<LexUnit> getRelatedLexUnits(LexRel type)
          Returns a List of LexUnits that have the relation type to this LexUnit.
 int getSense()
          Returns the sense number of this LexUnit.
 java.lang.String getSource()
          Returns the source of this LexUnit.
 java.util.List<LexUnit> getSynonyms()
          Returns the synonyms of this LexUnit - a List of LexUnits that are part of this LexUnit's Synset.
 Synset getSynset()
          Returns the Synset to which this LexUnit belongs.
 java.util.List<WiktionaryParaphrase> getWiktionaryParaphrases()
          Return a List of WiktionaryParaphrases for this LexUnit.
 WordCategory getWordCategory()
          Return the WordCategory of this LexUnit.
 boolean inWordCategory(WordCategory wordCategory)
          Return true if this LexUnit is in wordCategory.
 boolean isArtificial()
          Returns true if the artificial attribute is set, false otherwise.
 boolean isNamedEntity()
          Returns true if the namedEntity attribute is set, false otherwise.
 boolean isStyleMarking()
          Returns true if the styleMarking attribute is set, false otherwise.
 int numExamples()
          Return the number of Examples in this Synset.
 int numFrames()
          Return the number of Frames in this Synset.
 java.lang.String toString()
          Returns a String representation of this LexUnit.
protected  void trimAll()
          Trims all ArrayLists
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getSynset

public Synset getSynset()
Returns the Synset to which this LexUnit belongs.

Returns:
the Synset to which this LexUnit belongs

getSense

public int getSense()
Returns the sense number of this LexUnit.

Returns:
the sense number of this LexUnit

getId

public int getId()
Returns the unique identifier of this LexUnit.

Returns:
the unique identifier of this LexUnit

isStyleMarking

public boolean isStyleMarking()
Returns true if the styleMarking attribute is set, false otherwise.

Returns:
true if the styleMarking attribute is set, false otherwise

isArtificial

public boolean isArtificial()
Returns true if the artificial attribute is set, false otherwise.

Returns:
true if the artificial attribute is set, false otherwise

isNamedEntity

public boolean isNamedEntity()
Returns true if the namedEntity attribute is set, false otherwise.

Returns:
true if the namedEntity attribute is set, false otherwise

trimAll

protected void trimAll()
Trims all ArrayLists


getOrthForm

public java.lang.String getOrthForm()
Returns the orthographic form of this LexUnit.

Returns:
the orthographic form of this LexUnit

getOrthVar

public java.lang.String getOrthVar()
Returns the orthographic variant of this LexUnit.

Returns:
the orthographic variant of this LexUnit

getOldOrthForm

public java.lang.String getOldOrthForm()
Returns the old orthographic form of this LexUnit.

Returns:
the old orthographic form of this LexUnit

getOldOrthVar

public java.lang.String getOldOrthVar()
Returns the old orthographic variant of this LexUnit.

Returns:
the old orthographic variant of this LexUnit

getOrthForms

public java.util.List<java.lang.String> getOrthForms()
Returns a List of all orthographic forms of this LexUnit (i.e. the attributes orthForm, orthVar, oldOrthForm, and oldOrthVar).

Returns:
a List of all orthographic forms of this LexUnit (i.e. the attributes orthForm, orthVar, oldOrthForm, and oldOrthVar)

addRelation

protected void addRelation(LexRel type,
                           LexUnit target)
Adds a relation of the specified type to the target LexUnit.

Parameters:
type - the type of relation (eg. LexRel.antonymy)
target - the target LexUnit

getRelatedLexUnits

public java.util.List<LexUnit> getRelatedLexUnits(LexRel type)
Returns a List of LexUnits that have the relation type to this LexUnit.

Parameters:
type - type of relation to retrieve
Returns:
a List of LexUnits that have the relation type to this LexUnit. For example, antonyms of this LexUnit can be retrieved with the type LexRel.antonymy

getSynonyms

public java.util.List<LexUnit> getSynonyms()
Returns the synonyms of this LexUnit - a List of LexUnits that are part of this LexUnit's Synset.

Returns:
the synonyms of this LexUnit Same as getRelatedLexUnits(LexRel.synonymy)

getRelatedLexUnits

public java.util.List<LexUnit> getRelatedLexUnits()
Returns a List of all of the LexUnits that this LexUnit has any relation to.

Returns:
a List of all of the LexUnits that this LexUnit has any relation to

toString

public java.lang.String toString()
Returns a String representation of this LexUnit.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of this LexUnit

addExample

protected void addExample(Example example)
Adds an Example to this Synset.

Parameters:
example - the Example to add

addFrame

protected void addFrame(Frame frame)
Adds a Frame to this Synset.

Parameters:
frame - the Frame to add

getSource

public java.lang.String getSource()
Returns the source of this LexUnit.

Returns:
the source of this LexUnit

getExamples

public java.util.List<Example> getExamples()
Returns a List of this LexUnit's Examples/code>.

Returns:
a List of this LexUnit's Examples

getFrames

public java.util.List<Frame> getFrames()
Returns a List of this LexUnit's Frames.

Returns:
a List of this LexUnit's Frames

getWordCategory

public WordCategory getWordCategory()
Return the WordCategory of this LexUnit.

Returns:
the WordCategory of this LexUnit (eg. nomen, verben, adj).

inWordCategory

public boolean inWordCategory(WordCategory wordCategory)
Return true if this LexUnit is in wordCategory.

Parameters:
wordCategory - the WordCategory (eg. nomen, verben, adj)
Returns:
true if this LexUnit is in wordCategory

numFrames

public int numFrames()
Return the number of Frames in this Synset.

Returns:
the number of Frames in this Synset

numExamples

public int numExamples()
Return the number of Examples in this Synset.

Returns:
the number of Examples in this Synset

getIliRecords

public java.util.List<IliRecord> getIliRecords()
Return a List of IliRecords for this LexUnit.

Returns:
List of IliRecords for this LexUnit

addIliRecord

protected void addIliRecord(IliRecord record)
Add an IliRecord to this LexUnit.

Parameters:
record - IliRecord to add to this LexUnit

getWiktionaryParaphrases

public java.util.List<WiktionaryParaphrase> getWiktionaryParaphrases()
Return a List of WiktionaryParaphrases for this LexUnit.

Returns:
List of WiktionaryParaphrase for this LexUnit

addWiktionaryParaphrase

public void addWiktionaryParaphrase(WiktionaryParaphrase paraphrase)
Add a WiktionaryParaphrase to this LexUnit.

Parameters:
paraphrase - WiktionaryParaphrase to add to this LexUnit

equals

public boolean equals(LexUnit other)
Return true if this LexUnit is equal to another LexUnit.

Parameters:
other - the LexUnit to compare to
Returns:
true if this LexUnit is equal to another LexUnit