de.tudarmstadt.ukp.jwktl.api.entry
Class WiktionaryEntry

java.lang.Object
  extended by de.tudarmstadt.ukp.jwktl.api.entry.WiktionaryEntry
All Implemented Interfaces:
IWiktionaryEntry

@Persistent
public class WiktionaryEntry
extends Object
implements IWiktionaryEntry

Default implementation of the IWiktionaryEntry interface. See there for details.

Author:
Christian M. Meyer

Field Summary
protected  String entryLink
           
protected  String entryLinkType
           
protected  IWikiString etymology
           
protected  GrammaticalGender gender
           
protected  String header
           
protected  long id
           
protected  int index
           
protected  IWiktionaryPage page
           
protected  long pageId
           
protected  List<PartOfSpeech> partsOfSpeech
           
protected  List<IPronunciation> pronunciations
           
protected  List<WiktionarySense> senses
           
protected  List<IWiktionaryWordForm> wordForms
           
protected  ILanguage wordLanguage
           
protected  String wordLanguageStr
           
 
Constructor Summary
WiktionaryEntry()
          Instanciates a new, empty entry.
 
Method Summary
 void addPartOfSpeech(PartOfSpeech partOfSpeech)
          Adds the given part of speech to the list of part of speech tags.
 void addPronunciation(IPronunciation pronunciation)
          Adds the given pronunciation.
 void addSense(WiktionarySense sense)
          Add the given sense to the list of senses.
 void addWordForm(IWiktionaryWordForm wordForm)
          Adds the given word form.
 WiktionarySense createSense()
          Factory method for creating a new word sense.
 WiktionarySense findSenseByMarker(String marker)
          Identify the first sense of this entry with the given marker.
 String getEntryLink()
          Some lexical entries refer to other pages rather than encoding all information on the entry again.
 String getEntryLinkType()
          Returns the type of the IWiktionaryEntry.getEntryLink(), for example, denoting that the entry is an old spelling variant of the linked entry.
 List<IWikiString> getExamples()
          Returns a list containing all sense definitions of the entry's senses (including the unassigned sense).
 GrammaticalGender getGender()
          Returns the grammatical gender of this lexical entry, which can be one of masculine, feminine, neuter.
 List<IWikiString> getGlosses()
          Returns a list containing all sense definitions of the entry's senses (including the unassigned sense).
 String getHeader()
          Returns the header of the lexical entry.
 long getId()
          Returns an ID of this entry that is unique for all entries of the containing IWiktionaryPage.
 int getIndex()
          Returns the index of this entry.
 String getKey()
          Returns a unique ID for this lexical entry.
 IWiktionaryPage getPage()
          Returns a reference to the IWiktionaryPage that contains this entry.
 long getPageId()
          Returns the ID of the IWiktionaryPage that contains this entry.
 PartOfSpeech getPartOfSpeech()
          Returns the first part of speech tag encoded for this lexical entry.
 List<PartOfSpeech> getPartsOfSpeech()
          Returns all part of speech tags encoded for this lexical entry.
 List<IPronunciation> getPronunciations()
          Returns a list of pronunciations for this lexical entry.
 List<IQuotation> getQuotations()
          Returns a list containing all quotations of the entry's senses (including the unassigned sense).
 List<IWikiString> getReferences()
          Returns a list containing all references of the entry's senses (including the unassigned sense).
 List<IWiktionaryRelation> getRelations()
          Returns a list containing all semantic relations of the entry's senses (including the unassigned sense).
 List<IWiktionaryRelation> getRelations(RelationType relationType)
          Returns a list containing all semantic relations of the entry's senses (including the unassigned sense) of the given type.
 WiktionarySense getSense(int index)
          Returns the IWiktionarySense with the given index.
 int getSenseCount()
          Returns the number of IWiktionarySenses encoded for this lexical entry.
 List<IWiktionarySense> getSenses()
          Returns the list of all IWiktionarySenses.
 List<IWiktionarySense> getSenses(boolean includeUnassignedSense)
          Returns the list of all IWiktionarySenses.
 List<IWiktionaryTranslation> getTranslations()
          Returns a list containing all translations of the entry's senses (including the unassigned sense).
 List<IWiktionaryTranslation> getTranslations(ILanguage language)
          Returns a list containing all translations of the entry's senses (including the unassigned sense) to the given language.
 WiktionarySense getUnassignedSense()
          Returns a dummy IWiktionarySense that contains all information that has not been assigned to a particular sense.
 String getWord()
          Returns the lemma of this lexical entry denoted by the page title.
 IWikiString getWordEtymology()
          Returns the etymology of this lexical entry as a IWikiString.
 List<IWiktionaryWordForm> getWordForms()
          Returns a list of word forms for this lexical entry.
 ILanguage getWordLanguage()
          Returns the language of this lexical entry.
 void init(WiktionaryPage page)
          Initialize the entry using the given Wiktionary page.
 List<WiktionarySense> senses()
          Internal interface that is used by the parsers.
 void setEntryLink(String entryLink, String entryLinkType)
          Assigns the given entry link.
 void setGender(GrammaticalGender gender)
          Assigns the given grammatical gender.
 void setHeader(String header)
          Assigns the given header text (i.e., the first headline of the entry, which normally correponds to a word's lemma).
 void setId(long id)
          Assign the specified entry ID.
 void setWordEtymology(IWikiString etymology)
          Assigns the given etymology text.
 void setWordLanguage(ILanguage wordLanguage)
          Assigns the given word language.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected long id

index

protected int index

page

protected transient IWiktionaryPage page

pageId

protected long pageId

header

protected String header

wordLanguageStr

protected String wordLanguageStr

wordLanguage

protected transient ILanguage wordLanguage

partsOfSpeech

protected List<PartOfSpeech> partsOfSpeech

gender

protected GrammaticalGender gender

etymology

protected IWikiString etymology

entryLink

protected String entryLink

entryLinkType

protected String entryLinkType

pronunciations

protected List<IPronunciation> pronunciations

wordForms

protected List<IWiktionaryWordForm> wordForms

senses

protected List<WiktionarySense> senses
Constructor Detail

WiktionaryEntry

public WiktionaryEntry()
Instanciates a new, empty entry.

Method Detail

init

public void init(WiktionaryPage page)
Initialize the entry using the given Wiktionary page. This is necessary to initialize the back references to the parent page, which are not explicitly stored in the database.


createSense

public WiktionarySense createSense()
Factory method for creating a new word sense.


getKey

public String getKey()
Description copied from interface: IWiktionaryEntry
Returns a unique ID for this lexical entry. The ID is unique for all IWiktionaryEntrys of the IWiktionaryEdition. Note however that the ID of an entry may differ between different software versions or dump dates.

Specified by:
getKey in interface IWiktionaryEntry

getId

public long getId()
Description copied from interface: IWiktionaryEntry
Returns an ID of this entry that is unique for all entries of the containing IWiktionaryPage. Depending on the parsing mode, the ID may be a running number of entries or a sense index. Use IWiktionaryEntry.getKey() for a globally unique identifier. Note however that the ID of an entry may differ between different software versions or dump dates. IMPORTANT: The entry ID is unstable w.r.t. to different API versions and dump files. Better rely on page IDs and eventually local indices.

Specified by:
getId in interface IWiktionaryEntry

setId

public void setId(long id)
Assign the specified entry ID.


getIndex

public int getIndex()
Description copied from interface: IWiktionaryEntry
Returns the index of this entry. That is, the running number of the entry in accordance to the list of entries of the IWiktionaryPage (starting at 0).

Specified by:
getIndex in interface IWiktionaryEntry

getPage

public IWiktionaryPage getPage()
Description copied from interface: IWiktionaryEntry
Returns a reference to the IWiktionaryPage that contains this entry.

Specified by:
getPage in interface IWiktionaryEntry

getPageId

public long getPageId()
Description copied from interface: IWiktionaryEntry
Returns the ID of the IWiktionaryPage that contains this entry.

Specified by:
getPageId in interface IWiktionaryEntry

getWord

public String getWord()
Description copied from interface: IWiktionaryEntry
Returns the lemma of this lexical entry denoted by the page title. This method is equivalent to getPage().getTitle().

Specified by:
getWord in interface IWiktionaryEntry

getHeader

public String getHeader()
Description copied from interface: IWiktionaryEntry
Returns the header of the lexical entry. This is usually the lemma of the entry (i.e. equivalent to IWiktionaryEntry.getWord(), but there are some exceptions where the Wiktionary community uses a slightly different header.

Specified by:
getHeader in interface IWiktionaryEntry

setHeader

public void setHeader(String header)
Assigns the given header text (i.e., the first headline of the entry, which normally correponds to a word's lemma).


getWordLanguage

public ILanguage getWordLanguage()
Description copied from interface: IWiktionaryEntry
Returns the language of this lexical entry. This does not necessarily correspond to the language of the IWiktionaryEdition; e.g., for French entries within the English Wiktionary edition.

Specified by:
getWordLanguage in interface IWiktionaryEntry

setWordLanguage

public void setWordLanguage(ILanguage wordLanguage)
Assigns the given word language.


getPartOfSpeech

public PartOfSpeech getPartOfSpeech()
Description copied from interface: IWiktionaryEntry
Returns the first part of speech tag encoded for this lexical entry. The first tag is usually the most important one, although there can be multiple tags. Use {link #getPartsOfSpeech()} to access all part of speech tags encoded. If the part of speech is unknown or not specified, null will be returned.

Specified by:
getPartOfSpeech in interface IWiktionaryEntry

getPartsOfSpeech

public List<PartOfSpeech> getPartsOfSpeech()
Description copied from interface: IWiktionaryEntry
Returns all part of speech tags encoded for this lexical entry. Most of the time, only one part of speech tag is used. However, there are some cases, where multiple tags are used - e.g., for German adjectives/adverbs having the same form or for syntactic additions, such as "plurale tantum" (only taking the plural form). The ordering of tags used in Wiktionary is preserved. The resulted list is never null and includes at least one element.

Specified by:
getPartsOfSpeech in interface IWiktionaryEntry

addPartOfSpeech

public void addPartOfSpeech(PartOfSpeech partOfSpeech)
Adds the given part of speech to the list of part of speech tags.


getGender

public GrammaticalGender getGender()
Description copied from interface: IWiktionaryEntry
Returns the grammatical gender of this lexical entry, which can be one of masculine, feminine, neuter. If no gender is specified, null is returned.

Specified by:
getGender in interface IWiktionaryEntry

setGender

public void setGender(GrammaticalGender gender)
Assigns the given grammatical gender.


getWordEtymology

public IWikiString getWordEtymology()
Description copied from interface: IWiktionaryEntry
Returns the etymology of this lexical entry as a IWikiString. The result might be null if no etymology has been encoded.

Specified by:
getWordEtymology in interface IWiktionaryEntry

setWordEtymology

public void setWordEtymology(IWikiString etymology)
Assigns the given etymology text.


getEntryLink

public String getEntryLink()
Description copied from interface: IWiktionaryEntry
Some lexical entries refer to other pages rather than encoding all information on the entry again. This is similar to a redirect (IWiktionaryPage.getRedirectTarget()), but limited to the entry level. In addition to that, there might be further information provided.

Specified by:
getEntryLink in interface IWiktionaryEntry

getEntryLinkType

public String getEntryLinkType()
Description copied from interface: IWiktionaryEntry
Returns the type of the IWiktionaryEntry.getEntryLink(), for example, denoting that the entry is an old spelling variant of the linked entry.

Specified by:
getEntryLinkType in interface IWiktionaryEntry

setEntryLink

public void setEntryLink(String entryLink,
                         String entryLinkType)
Assigns the given entry link.


addPronunciation

public void addPronunciation(IPronunciation pronunciation)
Adds the given pronunciation.


getPronunciations

public List<IPronunciation> getPronunciations()
Description copied from interface: IWiktionaryEntry
Returns a list of pronunciations for this lexical entry. The list might be null if not pronunciations are encoded.

Specified by:
getPronunciations in interface IWiktionaryEntry

addWordForm

public void addWordForm(IWiktionaryWordForm wordForm)
Adds the given word form.


getWordForms

public List<IWiktionaryWordForm> getWordForms()
Description copied from interface: IWiktionaryEntry
Returns a list of word forms for this lexical entry. The list might be null if not word forms are encoded.

Specified by:
getWordForms in interface IWiktionaryEntry

addSense

public void addSense(WiktionarySense sense)
Add the given sense to the list of senses.


getUnassignedSense

public WiktionarySense getUnassignedSense()
Description copied from interface: IWiktionaryEntry
Returns a dummy IWiktionarySense that contains all information that has not been assigned to a particular sense. This is usually the case if the sense marker of an information does not match with any IWiktionarySense.getMarker() - e.g., containing question marks. The unassigned sense is never null. This method is equivalent to getSense(0).

Specified by:
getUnassignedSense in interface IWiktionaryEntry

getSense

public WiktionarySense getSense(int index)
Description copied from interface: IWiktionaryEntry
Returns the IWiktionarySense with the given index. IMPORTANT: The index is a running number starting at 1. Providing parameter 0 yields the unassigned sense (equivalent to IWiktionaryEntry.getUnassignedSense(). The maximum index is equivalent to IWiktionaryEntry.getSenseCount() (rather than IWiktionaryEntry.getSenseCount() - 1).

Specified by:
getSense in interface IWiktionaryEntry

getSenseCount

public int getSenseCount()
Description copied from interface: IWiktionaryEntry
Returns the number of IWiktionarySenses encoded for this lexical entry.

Specified by:
getSenseCount in interface IWiktionaryEntry

getSenses

public List<IWiktionarySense> getSenses()
Description copied from interface: IWiktionaryEntry
Returns the list of all IWiktionarySenses. The list is never null nor empty. The elements of the list are all senses of this entry, i.e. all senses with index 1 to IWiktionaryEntry.getSenseCount(). This method is equivalent to IWiktionaryEntry.getSenses(boolean) with parameter false.

Specified by:
getSenses in interface IWiktionaryEntry

getSenses

public List<IWiktionarySense> getSenses(boolean includeUnassignedSense)
Description copied from interface: IWiktionaryEntry
Returns the list of all IWiktionarySenses. The list is never null nor empty. If the parameter is set to true, the first element (list index 0) is the unassigned sense (equivalent to IWiktionaryEntry.getUnassignedSense(). The following elements are all senses of this entry, i.e. all senses with index 1 to IWiktionaryEntry.getSenseCount().

Specified by:
getSenses in interface IWiktionaryEntry

senses

public List<WiktionarySense> senses()
Internal interface that is used by the parsers.


findSenseByMarker

public WiktionarySense findSenseByMarker(String marker)
Identify the first sense of this entry with the given marker.


getGlosses

public List<IWikiString> getGlosses()
Description copied from interface: IWiktionaryEntry
Returns a list containing all sense definitions of the entry's senses (including the unassigned sense). Hence, the method is a shorthand for invoking IWiktionarySense.getGloss() for each sense. The list is never null but might be empty.

Specified by:
getGlosses in interface IWiktionaryEntry

getExamples

public List<IWikiString> getExamples()
Description copied from interface: IWiktionaryEntry
Returns a list containing all sense definitions of the entry's senses (including the unassigned sense). Hence, the method is a shorthand for invoking IWiktionarySense.getExamples() for each sense. The list is never null but might be empty.

Specified by:
getExamples in interface IWiktionaryEntry

getQuotations

public List<IQuotation> getQuotations()
Description copied from interface: IWiktionaryEntry
Returns a list containing all quotations of the entry's senses (including the unassigned sense). Hence, the method is a shorthand for invoking IWiktionarySense.getQuotations() for each sense. The list is never null but might be empty.

Specified by:
getQuotations in interface IWiktionaryEntry

getRelations

public List<IWiktionaryRelation> getRelations()
Description copied from interface: IWiktionaryEntry
Returns a list containing all semantic relations of the entry's senses (including the unassigned sense). Hence, the method is a shorthand for invoking IWiktionarySense.getRelations() for each sense. The list is never null but might be empty.

Specified by:
getRelations in interface IWiktionaryEntry

getRelations

public List<IWiktionaryRelation> getRelations(RelationType relationType)
Description copied from interface: IWiktionaryEntry
Returns a list containing all semantic relations of the entry's senses (including the unassigned sense) of the given type. Hence, the method is a shorthand for invoking IWiktionarySense.getRelations(RelationType) for each sense. The list is never null but might be empty.

Specified by:
getRelations in interface IWiktionaryEntry

getReferences

public List<IWikiString> getReferences()
Description copied from interface: IWiktionaryEntry
Returns a list containing all references of the entry's senses (including the unassigned sense). Hence, the method is a shorthand for invoking IWiktionarySense.getReferences() for each sense. The list is never null but might be empty.

Specified by:
getReferences in interface IWiktionaryEntry

getTranslations

public List<IWiktionaryTranslation> getTranslations()
Description copied from interface: IWiktionaryEntry
Returns a list containing all translations of the entry's senses (including the unassigned sense). Hence, the method is a shorthand for invoking IWiktionarySense.getTranslations() for each sense. The list is never null but might be empty.

Specified by:
getTranslations in interface IWiktionaryEntry

getTranslations

public List<IWiktionaryTranslation> getTranslations(ILanguage language)
Description copied from interface: IWiktionaryEntry
Returns a list containing all translations of the entry's senses (including the unassigned sense) to the given language. Hence, the method is a shorthand for invoking IWiktionarySense.getTranslations(ILanguage) for each sense. The list is never null but might be empty.

Specified by:
getTranslations in interface IWiktionaryEntry

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011-2013 Ubiquitous Knowledge Processing (UKP) Lab. All Rights Reserved.