Interface LKB<T extends Synset<S,R,E,G,X>, S extends Sense, R extends SynsetRelation, E extends SynsetRelationType, G extends Gloss, X extends Example, Q extends LKBQuery>

Type Parameters:
T - the Synset implementation
S - the Sense implementation
R - the SynsetRelation implementation
E - the SynsetRelationType implementation
G - the Gloss implementation
X - the Example implementation
Q - the LKBQuery implementation for querying over this LKB
All Superinterfaces:
Iterable<T>
All Known Implementing Classes:
BabelNet

public interface LKB<T extends Synset<S,R,E,G,X>, S extends Sense, R extends SynsetRelation, E extends SynsetRelationType, G extends Gloss, X extends Example, Q extends LKBQuery> extends Iterable<T>
An abstract lexical knowledge base.
Author:
navigli
  • Method Details

    • getSensesContaining

      List<S> getSensesContaining(String word)
      Returns the senses of synsets containing the word in any language.
      Parameters:
      word - the word whose senses are to be retrieved.
      Returns:
      the senses of the word.
    • getSensesContaining

      List<S> getSensesContaining(String word, it.uniroma1.lcl.jlt.util.Language language)
      Returns the senses of synsets containing the word in the given language.
      Parameters:
      word - the word whose senses are to be retrieved.
      language - the language of the input word.
      Returns:
      the senses of the word.
    • getSensesContaining

      List<S> getSensesContaining(String word, it.uniroma1.lcl.jlt.util.Language language, it.uniroma1.lcl.jlt.util.POS pos)
      Returns the senses of synsets containing the word with the given constraints.
      Parameters:
      word - the word whose senses are to be retrieved.
      language - the language of the input word.
      pos - the PoS of the word.
      Returns:
      the senses of the word.
    • getSensesContaining

      List<S> getSensesContaining(Q query)
      Returns the senses of synsets containing the word with the given constraints.
      Parameters:
      query - the query (use a query builder to build it).
      Returns:
      the senses of the word.
    • getSensesFrom

      List<S> getSensesFrom(String word)
      Returns the senses of synsets containing the word in any language.
      Parameters:
      word - the word whose senses are to be retrieved.
      Returns:
      the senses of the word.
    • getSensesFrom

      List<S> getSensesFrom(String word, it.uniroma1.lcl.jlt.util.Language language)
      Returns the senses of synsets containing the word in the given language.
      Parameters:
      word - the word whose senses are to be retrieved.
      language - the language of the input word.
      Returns:
      the senses of the word.
    • getSensesFrom

      List<S> getSensesFrom(String word, it.uniroma1.lcl.jlt.util.Language language, it.uniroma1.lcl.jlt.util.POS pos)
      Returns the senses of synsets containing the word with the given constraints.
      Parameters:
      word - the word whose senses are to be retrieved.
      language - the language of the input word.
      pos - the PoS of the word.
      Returns:
      the senses of the word.
    • getSensesFrom

      List<S> getSensesFrom(Q query)
      Returns the senses of the synsets with the given constraints.
      Parameters:
      query - the query (use a query builder to build it).
      Returns:
      the senses of the word.
    • getSynsets

      List<T> getSynsets(String word)
      Given a word, returns the synsets for the word.
      Parameters:
      word - the word whose synsets are to be retrieved.
      Returns:
      the synsets of the word.
    • getSynsets

      List<T> getSynsets(String word, it.uniroma1.lcl.jlt.util.Language language)
      Given a word in a certain language, returns the synsets for the word.
      Parameters:
      word - the word whose synsets are to be retrieved.
      language - the language of the input word.
      Returns:
      the synsets of the word.
    • getSynsets

      List<T> getSynsets(String word, it.uniroma1.lcl.jlt.util.Language language, it.uniroma1.lcl.jlt.util.POS pos)
      Given a word in a certain language, returns the synsets for the word.
      Parameters:
      word - the word whose synsets are to be retrieved.
      language - the language of the input word.
      pos - the PoS of the word.
      Returns:
      the synsets of the word.
    • getSynsets

      List<T> getSynsets(String word, Collection<it.uniroma1.lcl.jlt.util.Language> searchLanguages)
      Given a word and a collection of languages, returns the senses for the word available in the given sense sources.
      Parameters:
      word - the word whose senses are to be retrieved.
      searchLanguages - a collection of languages that can be used to look up the input word.
      Returns:
      the senses of the word.
    • getSynsets

      List<T> getSynsets(String word, Collection<it.uniroma1.lcl.jlt.util.Language> searchLanguages, it.uniroma1.lcl.jlt.util.POS pos)
      Given a word and a collection of languages, returns the synsets for the word available in the given sense sources.
      Parameters:
      word - the word whose synsets are to be retrieved.
      searchLanguages - a collection of languages that can be used to look up the input word.
      pos - the PoS of the word.
      Returns:
      the synsets of the word.
    • getSynsets

      List<T> getSynsets(ResourceID... resourceIds)
      Given a list of ResourceIDs, returns the synsets identified by the ResourceIDs in input.
      Parameters:
      resourceIds - the resource identifiers
      Returns:
      the synsets identified by the given ResourceIDs
    • getSynset

      T getSynset(ResourceID resourceID)
      Given a ResourceID, returns the synset identified by the ResourceID in input.

      Note: It is possible that this method gives a warning if the ResourceID returns more than one synset. In that case the best (see InternalBabelSynsetComparator) sense will be returned.

      Parameters:
      resourceID - the resource identifier
      Returns:
      the synset identified by the ResourceID

      Some examples that can be used follow, assuming:

      BabelNet bn = BabelNet.getInstance();

      Retrieving BabelSynset from a Wikipedia page title:

         BabelSynset synset = bn.getSynset(new WikipediaID("BabelNet", Language.EN, BabelPOS.NOUN));

      Retrieving BabelSynset from a Wikiquote page title:

         BabelSynset synset =  bn.getSynset(new WikiquoteID("Home", Language.EN, BabelPOS.NOUN));

      Retrieving BabelSynset from a WordNet id:

       BabelSynset synset = bn.getSynset(new WordNetSynsetID("wn:03544360n"));

      Retrieving BabelSynset from a Wikidata page id:

       BabelSynset synset = bn.getSynset(new WikidataID("Q4837690"));

      Retrieving BabelSynset from a OmegaWiki page id:

       BabelSynset synset = bn.getSynset(new OmegaWikiID("1499705"));
    • getSynsets

      List<T> getSynsets(Q query)
      Returns the synsets for the word with the given constraints.
      Parameters:
      query - the query (use a query builder to build it).
      Returns:
      the synsets of the word.
    • getVersion

      Version getVersion()
      Gets the version of loaded BabelNet indices
      Returns:
      the BabelVersion of BabelNet indices
    • iterator

      Iterator<T> iterator()
      Creates a new instance of Synset iterator.
      Specified by:
      iterator in interface Iterable<T extends Synset<S,R,E,G,X>>
      Returns:
      an instance of a Synset iterator.
    • getOffsetIterator

      Iterator<String> getOffsetIterator()
      Creates a new instance of an offset iterator.
      Returns:
      an instance of an offset iterator.
    • getLexiconIterator

      Iterator<it.uniroma1.lcl.jlt.ling.Word> getLexiconIterator()
      Creates a new instance of a lexicon iterator
      Returns:
      an instance of a lexicon iterator.
    • getWordNetSynsetIterator

      Iterator<BabelSynset> getWordNetSynsetIterator()
      Creates a new instance of a WordNet iterator
      Returns:
      an instance of a WordNet iterator.
    • toSynsets

      List<T> toSynsets(ResourceID id, Collection<it.uniroma1.lcl.jlt.util.Language> targetLanguages)
      Converts from ResourceID to the corresponding Synsets.
      Parameters:
      id - the input ResourceID
      targetLanguages - the target languages to populate synsets with
      Returns:
      the list of corresponding synsets
    • toSynsets

      default List<? extends T> toSynsets(ResourceID id)
      Converts from ResourceID to the corresponding Synsets.
      Parameters:
      id - the input ResourceID
      Returns:
      the list of corresponding synsets