Package it.uniroma1.lcl.kb
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- theSynsetimplementationS- theSenseimplementationR- theSynsetRelationimplementationE- theSynsetRelationTypeimplementationG- theGlossimplementationX- theExampleimplementationQ- theLKBQueryimplementation 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 Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Iterator<it.uniroma1.lcl.jlt.ling.Word>getLexiconIterator()Creates a new instance of a lexicon iteratorIterator<String>getOffsetIterator()Creates a new instance of an offset iterator.List<S>getSensesContaining(String word)Returns the senses of synsets containing the word in any language.List<S>getSensesContaining(String word, it.uniroma1.lcl.jlt.util.Language language)Returns the senses of synsets containing the word in the given language.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.List<S>getSensesContaining(Q query)Returns the senses of synsets containing the word with the given constraints.List<S>getSensesFrom(String word)Returns the senses of synsets containing the word in any language.List<S>getSensesFrom(String word, it.uniroma1.lcl.jlt.util.Language language)Returns the senses of synsets containing the word in the given language.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.List<S>getSensesFrom(Q query)Returns the senses of the synsets with the given constraints.TgetSynset(ResourceID resourceID)Given aResourceID, returns the synset identified by the ResourceID in input.List<T>getSynsets(ResourceID... resourceIds)Given a list ofResourceIDs, returns the synsets identified by the ResourceIDs in input.List<T>getSynsets(String word)Given a word, returns the synsets for the word.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.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.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.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.List<T>getSynsets(Q query)Returns the synsets for the word with the given constraints.VersiongetVersion()Gets the version of loaded BabelNet indicesIterator<BabelSynset>getWordNetSynsetIterator()Creates a new instance of a WordNet iteratorIterator<T>iterator()Creates a new instance ofSynsetiterator.default List<? extends T>toSynsets(ResourceID id)Converts fromResourceIDto the correspondingSynsets.List<T>toSynsets(ResourceID id, Collection<it.uniroma1.lcl.jlt.util.Language> targetLanguages)Converts fromResourceIDto the correspondingSynsets.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
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 ofResourceIDs, 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 aResourceID, returns the synset identified by the ResourceID in input.Note: It is possible that this method gives a warning if the
ResourceIDreturns more than one synset. In that case the best (seeInternalBabelSynsetComparator) sense will be returned.- Parameters:
resourceID- the resource identifier- Returns:
- the synset identified by the
ResourceIDSome 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
BabelVersionof BabelNet indices
-
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 fromResourceIDto the correspondingSynsets.- Parameters:
id- the inputResourceIDtargetLanguages- the target languages to populate synsets with- Returns:
- the list of corresponding synsets
-
toSynsets
default List<? extends T> toSynsets(ResourceID id)
Converts fromResourceIDto the correspondingSynsets.- Parameters:
id- the inputResourceID- Returns:
- the list of corresponding synsets
-
-