class OfflineIndex(BNIndex):
The offline version of the BNIndex.
Method | __init__ |
init method |
Method | examples |
Get the examples of a specific Babel synset, given a BabelSynsetID and a collection of InternalBabelSynsetID. |
Method | glosses |
Get the glosses of a specific BabelSynset, given a BabelSynsetID and a collection of InternalBabelSynsetID. |
Method | images |
Get the images of a specific Babel synset, given a BabelSynsetID. |
Method | lexicon |
Create a new instance of a lexicon iterator. |
Method | licence |
Given a ResourceID, get a list of InternalBabelSynsetIDs. |
Method | license |
Get the set of ids license for the word with the given constraints. |
Method | license |
Get the set of license ids of Documents in all indices from a given query. |
Method | mapping |
Get a mapping from a list of BabelSynsetIDs |
Method | offset |
Create a new instance of a offset iterator. |
Method | search |
Search the old offset of wordnet |
Method | successors |
Given a Babel id, collects the successors of the concept denoted by the id. |
Method | synset |
Return an instance of an empty BabelSynset. |
Method | synset |
Create a new instance of a synset iterator. |
Method | synsets |
Construct the list of BabelSynsets from a map of BabelSynsetIDs to list of InternalBabelSynsetID. |
Method | synsets |
Get a list of BabelSynset from a given ResourceID. |
Method | synsets |
Given a Wikipedia title, get its BabelSynsets. |
Method | synsets |
Get the set of ids license of Documents in all indices from a given WordNetSynsetID. |
Method | version |
The version of BabelNet. |
Method | wordnet |
Create a new instance of a wordnet iterator. |
Method | wordnet |
Retrieve WordNet 3.0 offset from old-version WordNet offSet. |
Method | _dictionary |
Get the list of Documents by mapping ID. |
Method | _doc |
Get a index-document lucene identifier (Babel synset ID). |
Method | _documents |
Search in index Glosses and Examples for the given InternalBabelSynsetIDs. |
Method | _info |
Get an info Document from a BabelNet ID. |
Method | _load |
Undocumented |
Method | _mapping |
Get a mapping Document from a License or BabelNet ID. |
Method | _merge |
Merge glosses or examples. |
Method | _merge |
Merge all Lucene dictionary Documents, that have the same id. The ids are replaced initially with the final BabelNet id. |
Method | _multi |
Undocumented |
Method | _synset |
Get a full-fledged BabelSynset from a Document. |
Instance Variable | _babelnet |
Undocumented |
Instance Variable | _dictionary |
Undocumented |
Instance Variable | _graph |
Undocumented |
Instance Variable | _image |
Undocumented |
Instance Variable | _info |
Undocumented |
Instance Variable | _languages |
Undocumented |
Instance Variable | _lexicon |
Undocumented |
Instance Variable | _license |
Dictionaries (other licenses). |
Instance Variable | _license |
Glosses (other licenses). |
Instance Variable | _wordnet |
Undocumented |
Get the examples of a specific Babel synset, given a BabelSynsetID and a collection of InternalBabelSynsetID.
Parameters | |
id_:BabelSynsetID | the BabelSynsetID form where to get the examples |
filterSet[Language] | the languages to filter |
*ids:_InternalBabelSynsetID | the _InternalBabelSynsetID(s) |
Returns | |
List[BabelExample] | the list of BabelExample(es) retrieved from the BabelSynset |
Raises | |
RuntimeError |
Get the glosses of a specific BabelSynset, given a BabelSynsetID and a collection of InternalBabelSynsetID.
Parameters | |
id_:BabelSynsetID | the BabelSynsetID form where to get the glosses |
filterSet[Language] | the languages to filter |
*ids:_InternalBabelSynsetID | the _InternalBabelSynsetID(s) |
Returns | |
List[BabelGloss] | the list of BabelGloss(es) retrieved from the BabelSynset |
Get the images of a specific Babel synset, given a BabelSynsetID.
Parameters | |
id_:BabelSynsetID | the BabelSynsetID form where to get the images |
Returns | |
List[BabelImage] | the list of BabelImage(es) retrieved from the BabelSynset |
Create a new instance of a lexicon iterator.
Returns | |
BabelLexiconIterator | the lexicon iterator |
Given a ResourceID, get a list of InternalBabelSynsetIDs.
Parameters | |
resourceResourceID | The resource. |
Returns | |
List[_InternalBabelSynsetID] | The list of InternalBabelSynsetIDs associated to the given ResourceID. |
Get the set of ids license for the word with the given constraints.
Parameters | |
word:str | The word whose senses are to be retrieved. |
poses:Set[POS] | The PoSes of the word to be retrieved. |
langs:Set[Language] | The search languages for the input word. |
normalizer:bool | True if normalization should be applied when searching. |
Returns | |
List[_InternalBabelSynsetID] | The list of InternalBabelSynsetIDs associated with the given constraints. |
Get the set of license ids of Documents in all indices from a given query.
Parameters | |
q | a Lucene Query used to obtain the Lucene documents. |
Returns | |
List[_InternalBabelSynsetID] | the list of the license ids's (as _InternalBabelSynsetID) from the dictionary document |
Get a mapping from a list of BabelSynsetIDs
Parameters | |
*ids:BabelSynsetID | Collection of BabelSynsetID |
Returns | |
Dict[BabelSynsetID , List[_InternalBabelSynsetID]] | For each BabelSynsetID returns the necessary indexes to create the BabelSynset |
Create a new instance of a offset iterator.
Returns | |
BabelOffsetIterator | the babel offset iterator |
Search the old offset of wordnet
Parameters | |
offset:str | Undocumented |
Returns | |
Dict[ | Undocumented |
Given a Babel id, collects the successors of the concept denoted by the id.
Parameters | |
id_:BabelSynsetID | A concept identifier (babel synset ID) |
Returns | |
Optional[List[str]] | Return a stringified representation of the edges departing from the Babel synset denoted by the input id. |
Return an instance of an empty BabelSynset.
Parameters | |
id_:BabelSynsetID | the id to search |
idList[_InternalBabelSynsetID] | the list of _InternalBabelSynsetID |
Returns | |
BabelSynset | a BabelSynset |
Create a new instance of a synset iterator.
Returns | |
BabelSynsetIterator | An iterator over BabelNet's synsets |
babelnet.indices.index.BNIndex.synsets
Construct the list of BabelSynsets from a map of BabelSynsetIDs to list of InternalBabelSynsetID.
Parameters | |
id2licenseDict[BabelSynsetID , List[_InternalBabelSynsetID]] | Map of BabelSynsetIDs to list of InternalBabelSynsetID. |
targetSet[Language] | The languages to include in the synsets. |
Returns | |
List[BabelSynset] | The list of constructed synsets. |
Get a list of BabelSynset from a given ResourceID.
Parameters | |
id_:ResourceID | The ResourceID. |
id2licenseDict[BabelSynsetID , List[_InternalBabelSynsetID]] | a dict that maps BabelSynsetID to a list of _InternalBabelSynsetID |
targetSet[Language] | The output language |
Returns | |
List[BabelSynset] | The list of BabelSynsets associated to the given ResourceID. |
Given a Wikipedia title, get its BabelSynsets.
Parameters | |
language:Language | The language of the input Wikipedia title. |
title:str | The title of the Wikipedia page. |
id2licenseDict[BabelSynsetID , List[_InternalBabelSynsetID]] | a dict that maps BabelSynsetID to a list of _InternalBabelSynsetID |
Returns | |
List[BabelSynset] | The list of BabelSynsets associated to the given Wikipedia title. |
Get the set of ids license of Documents in all indices from a given WordNetSynsetID.
Parameters | |
offset:WordNetSynsetID | A WordNet offset. |
Returns | |
List[_InternalBabelSynsetID] | A list of InternalBabelSynsetIDs associated to the given constraints. |
babelnet.indices.index.BNIndex.version
The version of BabelNet.
Returns | |
BabelVersion | the version |
Create a new instance of a wordnet iterator.
Returns | |
WordNetSynsetIterator | an iterator over Wordnet's synsets |
Retrieve WordNet 3.0 offset from old-version WordNet offSet.
Parameters | |
offset:str | The wordnet offset |
version:WordNetVersion | the wordnet version |
Returns | |
List[WordNetSynsetID] | A list of WordNetSynsetID at the specified offset for that specified version |
Raises | |
InvalidSynsetIDError | |
JavaError |
Get the list of Documents by mapping ID.
Parameters | |
id_:BabelSynsetID | A BabelNetID. |
*ids:_InternalBabelSynsetID | License IDs of the various synset pieces. |
Returns | |
List[Document] | a list of documents |
Get a index-document lucene identifier (Babel synset ID).
Parameters | |
id_:BabelSynsetID | The Babel synset ID for a specific concept. |
dictIndexSearcher | IndexSearcher. |
Returns | |
Optional[Document] | The Document |
Search in index Glosses and Examples for the given InternalBabelSynsetIDs.
Parameters | |
*ids:_InternalBabelSynsetID | the _InternalBabelSynsetID to use for the search |
Returns | |
List[Document] | THe list of Document(s) associated to the given ids |
Raises | |
JavaError |
Get an info Document from a BabelNet ID.
This function interrogates the index and returns the Document where the id_ is found.
Parameters | |
id_:str | the id |
Returns | |
Document | the Document |
Raises | |
JavaError | Error raised from Java |
Get a mapping Document from a License or BabelNet ID.
Parameters | |
id_:str | The input id. |
field:BabelNetIndexField | The kind of id. |
Returns | |
Optional[Document] | the document. |
Merge glosses or examples.
Parameters | |
id_:BabelSynsetID | Undocumented |
doc:Document | Undocumented |
docs:List[ | Undocumented |
typeBabelNetIndexField | Undocumented |
Returns | |
Document | Undocumented |
Raises | |
JavaError |
Merge all Lucene dictionary Documents, that have the same id. The ids are replaced initially with the final BabelNet id.
Parameters | |
docsSet[ | Undocumented |
Returns | |
Document | Undocumented |
Undocumented
Parameters | |
id2idDict[ | Undocumented |
Returns | |
Dict[ | Undocumented |
Get a full-fledged BabelSynset from a Document.
Parameters | |
doc:Document | A Lucene Document record for a certain Babel synset. |
licenseList[_InternalBabelSynsetID] | A list of licence IDs. |
targetSet[Language] | The languages to use for search. |
Returns | |
Optional[BabelSynset] | An instance of a BabelSynset from a Document. |