pybabelnet.data package

Module contents

This package contains the classes of the BabelSynsets components.

Submodules

pybabelnet.data.category module

This module contains the BabelCategory class.

class pybabelnet.data.category.BabelCategory(category, language)

Bases: object

A Wikipedia category associated with a BabelSynset.

Parameters:
  • category (str) – The category string.
  • language (Language) – The category language.
category

str – The category itself, e.g. 'Scientists who commited suicide'.

language

Language – The language of the category label, English, Italian, etc.

license = 'CBS30'

The license for this Babel category.

wikipedia_uri

The URI of the Wikipedia page this BabelCategory corresponds to.

Return type:str

Examples:

  • for the English category 'Mathematicians_who_committed_suicide': 'http://en.wikipedia.org/wiki/Category:Mathematicians_who_committed_suicide'
  • for the German category 'Kategorie:Mitglied der Royal Society': 'http://de.wikipedia.org/wiki/Kategorie:Mitglied_der_Royal_Society'
static from_string(category_string)

Create a new instance of a BabelCategory from a string with format <language_id>:<category_label>, e.g. EN:Scientist_who_committed_suicide.

Parameters:category_string (str) – The string of the category to be retrieved.
Returns:An instance of a BabelCategory from an input string.
Return type:Optional[BabelCategory]
static category_prefix(language) → Union[str, NoneType]

Get the prefix of a category in the selected language.

Parameters:language (Language) – The prefix language.
Returns:The prefix.
Return type:Optional[str]

pybabelnet.data.compare module

This module contains comparators for BabelSynsets and BabelSynsetRelations.

class pybabelnet.data.compare.BabelSynsetGlossComparator(word, language=EN)

Bases: object

Comparator for BabelSynsets that:

  • sorts Babel synsets using their glosses number
  • sorts using BabelSynsetComparator
Parameters:word (str) – The word whose sense numbers are used to sort the BabelSynsets corresponding to WordNet synsets.
Keyword Arguments:
 language (Language) – The language used to sort senses (default Language.EN).
compare(b1, b2)
Parameters:
Returns:

Compare result.

Return type:

int

class pybabelnet.data.compare.BabelSynsetRelationComparator(word, language=EN)

Bases: object

Comparator for BabelSynsets that

  • sorts Babel synsets using theirs relations number
  • sorts using BabelSynsetComparator
Parameters:word (str) – The word whose sense numbers are used to sort the BabelSynsets corresponding to WordNet synsets.
Keyword Arguments:
 language (Language) – The language used to sort senses (default English).
compare(b1, b2)
Parameters:
Returns:

Compare result.

Return type:

int

class pybabelnet.data.compare.BabelSynsetIDRelationComparator

Bases: object

Comparator for BabelSynsetRelations that

  • puts manual relations first
  • sorts relations using their relation type (HYPERNYM, HYPONYM and MERONYM)
  • sorts lexicographically using their relation name
  • sorts lexicographically using their id target
static compare(rel1, rel2)
Parameters:
Returns:

Compare result.

Return type:

int

pybabelnet.data.domain module

This module contains the BabelDomain enum.

class pybabelnet.data.domain.BabelDomain(*args, **kwds)

Bases: aenum.Enum

Domain of a BabelSynset.

domain_string(self)

The original name of the domain.

Return type:str
classmethod from_position(cls, position)

Return the BabelDomain of the position given in input.

Parameters:position (int) – The position of the requested BabelDomain.
Returns:The corresponding BabelDomain.
Return type:BabelDomain
Raises:ValueError
ART_ARCHITECTURE_AND_ARCHAEOLOGY = 'Art, architecture, and archaeology'
BIOLOGY = 'Biology'
ANIMALS = 'Animals'
BUSINESS_ECONOMICS_AND_FINANCE = 'Business, economics, and finance'
NUMISMATICS_AND_CURRENCIES = 'Numismatics and currencies'
CHEMISTRY_AND_MINERALOGY = 'Chemistry and mineralogy'
COMPUTING = 'Computing'
CULTURE_AND_SOCIETY = 'Culture and society'
EDUCATION = 'Education'
ENGINEERING_AND_TECHNOLOGY = 'Engineering and technology'
FOOD_AND_DRINK = 'Food and drink'
GEOGRAPHY_AND_PLACES = 'Geography and places'
GEOLOGY_AND_GEOPHYSICS = 'Geology and geophysics'
HEALTH_AND_MEDICINE = 'Health and medicine'
HERALDRY_HONORS_AND_VEXILLOLOGY = 'Heraldry, honors, and vexillology'
HISTORY = 'History'
LANGUAGE_AND_LINGUISTICS = 'Language and linguistics'
LAW_AND_CRIME = 'Law and crime'
LITERATURE_AND_THEATRE = 'Literature and theatre'
MATHEMATICS = 'Mathematics'
MEDIA = 'Media'
METEOROLOGY = 'Meteorology'
MUSIC = 'Music'
PHILOSOPHY_AND_PSYCHOLOGY = 'Philosophy and psychology'
PHYSICS_AND_ASTRONOMY = 'Physics and astronomy'
POLITICS_AND_GOVERNMENT = 'Politics and government'
RELIGION_MYSTICISM_AND_MYTHOLOGY = 'Religion, mysticism and mythology'
ROYALTY_AND_NOBILITY = 'Royalty and nobility'
SPORT_AND_RECREATION = 'Sport and recreation'
TRANSPORT_AND_TRAVEL = 'Transport and travel'
GAMES_AND_VIDEO_GAMES = 'Games and video games'
WARFARE_AND_DEFENSE = 'Warfare and defense'
FARMING = 'Farming'
TEXTILE_AND_CLOTHING = 'Textile and clothing'
COLORS = 'Colors'
COMMUNICATION_AND_TELECOMMUNICATION = 'Communication and telecommunication'
EMOTIONS = 'Emotions'
ENVIRONMENT = 'Environment'
FISHING_AND_HUNTING = 'Fishing and hunting'
NAUTICS = 'Nautics'
SEX = 'Sex'
TIME = 'Time'

pybabelnet.data.example module

This module contains the BabelExample class and the related comparator.

class pybabelnet.data.example.BabelExample(source, source_sense, language, example, tokens=None)

Bases: object

An example sentence in BabelNet.

Parameters:
  • source (BabelSenseSource) – The example source.
  • source_sense (str) – The sense of the example.
  • language (Language) – The language the example is written in.
  • example (str) – The example string.
Keyword Arguments:
 

tokens (Optional[Set[BabelTokenWord]]) – The tokens that belong to the example (default None).

source

BabelSenseSource – The region of BabelNet from which this example comes from.

source_sense

str – The WordNet or Wikipedia sense from which the sense is taken.

language

Language – The language of the example.

example

str – The example itself.

tokens_word_example

Set[BabelTokenWord] – A set of BabelTokenWords. Each BabelTokenWord corresponds to the lemma that appears in this Babel example and for which it is an usage example.

license

The license for this Babel example.

Return type:BabelLicense
class pybabelnet.data.example.BabelExampleComparator(main_sense: pybabelnet.sense.BabelSense = None)

Bases: object

Comparator for BabelExamples which sorts by sources.

Keyword Arguments:
 main_sense (Optional[BabelSense]) – The sense the examples refer to (default None).
compare(b1, b2)
Parameters:
Returns:

Compare result.

Return type:

int

pybabelnet.data.gloss module

This module contains the BabelGloss class and the related comparator.

class pybabelnet.data.gloss.BabelGloss(source, source_sense, language, gloss, tokens=None)

Bases: object

A gloss in BabelNet.

Parameters:
  • source (BabelSenseSource) – The gloss source.
  • source_sense (str) – The sense the gloss defines.
  • language (Language) – The language the gloss is written in.
  • gloss (str) – The gloss string.
Keyword Arguments:
 

tokens (Optional[Set[BabelTokenId]]) – The tokens that belong to the gloss (default None)

source

BabelSenseSource – The region of BabelNet from which this gloss comes from.

source_sense

str – The WordNet or Wikipedia sense from which the sense is taken.

language

Language – The language of the gloss.

gloss

str – The gloss string.

token_ids

Set[BabelTokenId] – A list of BabelTokenIds. Each BabelTokenId is the association between the lemma that appears in this Babel gloss, and the BabelSynset id that identifies the lemma in BabelNet.

license

The license for this Babel gloss.

Return type:BabelLicense
class pybabelnet.data.gloss.BabelGlossComparator(main_sense: pybabelnet.sense.BabelSense = None)

Bases: object

Comparator for BabelGlosses which sorts by sources.

Keyword Arguments:
 main_sense (Optional[BabelSense]) – The sense the glosses refer to (default None).
compare(b1, b2)
Parameters:
Returns:

Compare result.

Return type:

int

pybabelnet.data.image module

This module contains the BabelImage class and related data.

class pybabelnet.data.image.BabelImage(title, language, url, thumb_url, source, license_, is_bad)

Bases: object

An image in BabelNet.

Parameters:
  • title (str) – Image title.
  • language (str) – Image language
  • url (str) – Image URL.
  • thumb_url (str) – Image thumbnail URL.
  • source (str) – URL source.
  • license (str) – Image license.
  • is_bad (bool) – Is it a bad/censored image?
name

str – The short name / MediaWiki page name for the image, e.g.

'Haile-newyork-cropforfocus.jpg'
languages

Set[Language] – The languages of the Wikipedia this image comes from.

url_source

BabelImageSource – Source of the image URL.

thumb_url

str – The URL thumb to the actual image, e.g.

'http://upload.wikimedia.org/wikipedia/commons/9/94/Haile-newyork-cropforfocus.jpg/120px-Haile-newyork-cropforfocus.jpg'
url

str – The URL to the actual image, e.g.

'http://upload.wikimedia.org/wikipedia/commons/9/94/Haile-newyork-cropforfocus.jpg'
license

str – Image license.

id_bad

bool – True if bad or censored image.

add_language(language)

Add a new Language.

Parameters:language (Language) – The language to add.
class pybabelnet.data.image.BabelImageComparator

Bases: object

Comparator for BabelImages which sorts by source.

static compare(b1, b2)
Parameters:
Returns:

int

pybabelnet.data.lemma module

This module contains the BabelLemma class and related data.

class pybabelnet.data.lemma.BabelLemma(lemma, lemma_type)

Bases: object

A class representing the lemma in a BabelSynset.

Parameters:
lemma

str – The lemma.

lemma_type

BabelLemmaType – The lemma type.

class pybabelnet.data.lemma.BabelLemmaType(*args, **kwds)

Bases: aenum.OrderedEnum

Types of lemmas in BabelNet.

classmethod from_babel_sense_source(cls, source, language)

Get the lemma type from a BabelSenseSource and its Language.

Parameters:
Returns:

The lemma type.

Return type:

BabelLemmaType

HIGH_QUALITY = 1

High quality lemmas, coming from professionally-curated res (such as WordNet or WordAtlas) or reliable crowdsources res.

POTENTIAL_NEAR_SYNONYM_OR_WORSE = 2

Mostly Wikipedia redirections, which might be synonyms, near synonyms or related terms.

AUTOMATIC_TRANSLATION = 3

Lemmas resulting from automatic translations (suggested use only for automatic text processing).

pybabelnet.data.license module

This module contains the BabelLicense enum.

class pybabelnet.data.license.BabelLicense(*args, **kwds)

Bases: aenum.Enum

License information for a BabelNet item.

short_name(self)
Return type:str
classmethod long_name(cls, string_name)

Return the BabelLicence for a given string.

Parameters:string_name (str) – The license string
Returns:The corresponding license.
Return type:Optional[BabelLicense]
UNRESTRICTED = 'UNR'

All the permissive licenses without specific restrictions.

CC_BY_SA_30 = 'CBS30'

Creative Commons Attribution-ShareAlike 3.0 License.

CC_BY_SA_40 = 'CBS40'

Creative Commons Attribution-ShareAlike 4.0 International.

CC_BY_30 = 'CB30'

Creative Commons Attribution 3.0 License.

CECILL_C = 'CEC'

CeCILL-C free software license agreement.

APACHE_20 = 'APCH20'

Apache 2.0 License.

CC_BY_NC_SA_30 = 'CBNS30'

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

MLP = 'MLP'

Microsoft language portal materials license.

OTHER = 'OTHER'

Items without specific licenses.

WORDNET = 'WORDNET'

WordNet license.

MIT = 'MIT'

MIT license.

ODC_BY_10 = 'ODCBY10'

ODC-BY 1.0 license.

GFDL_12 = 'GFDL12'

GFDL 1.2 license.

pybabelnet.data.phonetics module

This module contains the BabelSensePhonetic class and related data.

class pybabelnet.data.phonetics.BabelAudio(lemma, language, filename)

Bases: object

An audio item in BabelNet.

Parameters:
  • lemma (str) – Lemma pronounced.
  • language (Language) – Lemma language.
  • filename (str) – Audio filename associated.
lemma

str – Lemma pronounced.

language

Language – Lemma language.

filename

str – Audio filename associated.

url

The full URL of this BabelAudio.

Return type:str
class pybabelnet.data.phonetics.BabelSensePhonetics(audios, transcriptions)

Bases: object

A class modeling audio and transcription of a BabelSense.

Parameters:
  • audios (Set[BabelAudio]) – Set of audio items.
  • transcriptions (Set[str]) – Set of pronunciation transcriptions.
audios

Set[BabelAudio] – Set of audio items.

transcriptions

Set[str] – Set of pronunciation transcriptions.

pybabelnet.data.phonetics.transcription_from_string(value)

Transform a transcription string into a pair of (language_lemma, transcription)s.

Parameters:value (str) – Transcription string.
Returns:Tuple[str, str]
Raises:RuntimeError
pybabelnet.data.phonetics.audio_from_string(value)

Transform an audio string into a pair of (language_lemma, audio_item)s.

Parameters:value (str) – Audio string.
Returns:Tuple[str, BabelAudio]
Raises:RuntimeError

pybabelnet.data.relation module

This module contains BabelSynsetRelation and data related to the edges in the BabelNet graph.

class pybabelnet.data.relation.RelationGroup(*args, **kwds)

Bases: aenum.AutoNumberEnum

Group of relations (used to bring together relations belonging to the same group).

HYPERNYM = 1
HYPONYM = 2
MERONYM = 3
HOLONYM = 4
OTHER = 5
class pybabelnet.data.relation.BabelSynsetRelation(language, pointer, target)

Bases: object

Class that models a relation to a synset ID in the BabelNet network.

Parameters:
  • language (Language) – The language of the relation.
  • pointer (BabelPointer) – The relation type.
  • target (str) – The target offset.
language

Language – The language of the relation.

pointer

BabelPointer – The relation type.

target

str – The target offset.

static from_string(edge)

Create a new instance of BabelSynsetRelation from an input record in the same format as found in BabelNetIndexField.

Parameters:edge (str) – The String representation of the edge.
Returns:Relation instance.
Return type:BabelSynsetRelation
id_target

The target as a BabelSynsetID.

Return type:BabelSynsetID
exception pybabelnet.data.relation.BabelPointerNotPresentError

Bases: RuntimeError

class pybabelnet.data.relation.BabelPointer(symbol, relation_name, short_name, relation_group=OTHER, is_automatic=False)

Bases: aenum.Enum

Models a semantic pointer in BabelNet. Includes an associative (i.e. semantically unspecified) relation.

Parameters:
  • symbol (str) – The symbol in BabelNet data files that is used to indicate this pointer type.
  • relation_name (str) – Relation name.
  • short_name (str) – Relation short name.
  • relation_group (RelationGroup) – Relation group the pointer belongs to (e.g. HYPERNYM).
Keyword Arguments:
 

is_automatic (bool) – Is automatic relation (default False).

Notes

At runtime this Enum is expanded with additional values.

symbol

str – The symbol in BabelNet data files that is used to indicate this pointer type. Will not be None, empty, or all whitespace.

relation_name

str – Relation name.

short_name

str – Relation short name.

relation_group

RelationGroup – Relation group the pointer belongs to (e.g. HYPERNYM).

is_automatic

bool – Is automatic relation.

is_hypernym(self)

True if the relation is of a hypernymy kind.

Return type:bool
is_hyponymy(self)

True if the relation is of a hyponymy kind.

Return type:bool
is_meronym(self)

True if the relation is of a meronym kind.

Return type:bool
is_holonym(self)

True if the relation is of a holonym kind.

Return type:bool
classmethod from_name(cls, name)

Return the pointer types that match the specified pointer name.

Parameters:name (str) – The name string of the relations.
Returns:The BabelPointers corresponding to the given name.
Return type:List[BabelPointer]
Raises:BabelPointerNotPresentError – Raised if the name does not correspond to a known pointer.
classmethod from_symbol(cls, symbol)

Return the pointer type that matches the specified pointer symbol.

Parameters:symbol (str) – The string representation of the semantic relation.
Returns:The type of semantic relation.
Return type:BabelPointer
Raises:BabelPointerNotPresentError – Raised if the name does not correspond to a known pointer.

“Wikipedia relations.

GLOSS_MONOSEMOUS = ('gmono', 'Gloss related form (monosemous)', 'gloss-related')

Gloss related form (monosemous) from WordNet.

GLOSS_DISAMBIGUATED = ('gdis', 'Gloss related form (disambiguated)', 'gloss-related')

Gloss related form (disambiguated) from WordNet.

ALSO_SEE = ('^', 'Also See', 'also-see')

Also See from WordNet.

ANTONYM = ('!', 'Antonym', 'antonym')

Antonym from WordNet.

ATTRIBUTE = ('=', 'Attribute', 'attrib')

Attribute from WordNet.

CAUSE = ('>', 'Cause', 'cause')

Cause from WordNet.

Derivationally related form from WordNet.

ENTAILMENT = ('*', 'Entailment', 'entails')

Entailment from WordNet.

HYPERNYM = ('@', 'Hypernym', 'is-a', HYPERNYM)

Hypernym from WordNet.

HYPERNYM_INSTANCE = ('@i', 'Instance hypernym', 'is-a', HYPERNYM)

Instance hypernym from WordNet.

HYPONYM = ('~', 'Hyponym', 'has-kind', HYPONYM)

Hyponym from WordNet.

HYPONYM_INSTANCE = ('~i', 'Instance hyponym', 'has-kind', HYPONYM)

Instance hyponym from WordNet.

HOLONYM_MEMBER = ('#m', 'Member holonym', 'has-part', HOLONYM)

Member holonym from WordNet.

HOLONYM_SUBSTANCE = ('#s', 'Substance holonym', 'has-part', HOLONYM)

Substance holonym from WordNet.

HOLONYM_PART = ('#p', 'Part holonym', 'has-part', HOLONYM)

Part holonym from WordNet.

MERONYM_MEMBER = ('%m', 'Member meronym', 'part-of', MERONYM)

Member meronym from WordNet.

MERONYM_SUBSTANCE = ('%s', 'Substance meronym', 'part-of', MERONYM)

Substance meronym from WordNet.

MERONYM_PART = ('%p', 'Part meronym', 'part-of', MERONYM)

Part meronym from WordNet.

PARTICIPLE = ('<', 'Participle', 'participle')

Participle from WordNet.

PERTAINYM = ('\\', 'Pertainym BabelPointer(pertains to nouns)', 'pertains-to')

Pertainym from WordNet.

REGION = (';r', 'Domain of synset - REGION', 'domain')

Domain of synset - REGION from WordNet.

REGION_MEMBER = ('-r', 'Member of this domain - REGION', 'domain')

Member of this domain from WordNet.

SIMILAR_TO = ('&', 'Similar To', 'sim')

Similar To from WordNet.

TOPIC = (';c', 'Domain of synset - TOPIC', 'topic')

Domain of synset - TOPIC from WordNet.

TOPIC_MEMBER = ('-c', 'Member of this domain - TOPIC', 'topic')

Member of this domain - TOPIC from WordNet.

USAGE = (';u', 'Domain of synset - USAGE', 'usage')

Domain of synset - USAGE from WordNet.

USAGE_MEMBER = ('-u', 'Member of this domain - USAGE', 'usage')

Member of this domain - USAGE from WordNet.

VERB_GROUP = ('$', 'Verb Group', 'verb_group')

Verb Group from WordNet.

WIBI_HYPERNYM = ('@w', 'Hypernym', 'is-a', HYPERNYM, True)

Hypernym from Wikipedia Bitaxonomy.

WIKIDATA_HYPERNYM = ('@wd', 'Hypernym', 'is-a', HYPERNYM)

Hypernym from Wikidata.

WIKIDATA_MERONYM = ('%wdm', 'Part meronym', 'part-of', MERONYM)

Meronym from Wikidata.

WIBI_HYPONYM = ('~@w', 'Hyponym', 'has-kind', HYPONYM, True)

Hyponym from Wikipedia Bitaxonomy.

WIKIDATA_HYPONYM_INSTANCE = ('~wd', 'Hyponym', 'has-kind', HYPONYM)

Hyponym instance from Wikidata.

WIKIDATA_HYPONYM = ('~wds', 'Hyponym', 'has-kind', HYPONYM)

Hyponym from Wikidata.

ANY_HYPERNYM = ('ahpe', 'Any Hypernym', 'is-a', HYPERNYM)

Hypernyms from all res.

ANY_MERONYM = ('am', 'Any Meronym', 'part-of', MERONYM)

Meronyms from all res.

ANY_HOLONYM = ('aho', 'Any Holonym', 'has-part', HOLONYM)

Holonyms from all res.

ANY_HYPONYM = ('ahpo', 'Any Hyponym', 'has-kind', HYPONYM)

Hyponyms from all res.

pybabelnet.data.source module

Sources of BabelSenses in BabelNet.

class pybabelnet.data.source.BabelSenseSource(ordinal_for_sorting, source_name, uri=None)

Bases: aenum.NoAliasEnum

Enumeration of the different sources for the BabelNet senses.

Parameters:
  • ordinal_for_sorting (int) – Ordinal for sense sorting.
  • source_name (str) – Name of the source.
Keyword Arguments:
 

uri (str) – Source URI (default None).

ordinal_for_sorting

int – Ordinal for sorting senses.

source_name

str – Source name.

is_from_any_wordnet(self)

True if the source is any wordnet (Princeton WordNet or any other language).

Return type:bool
is_from_multi_wordnet(self)

True if the source is any wordnet (Princeton WordNet is not included)

Return type:bool
is_from_wordnet(self)

True if the source is Princeton WordNet.

Return type:bool
is_from_babelnet(self)

True if the source is BabelNet.

Return type:bool
is_from_wordatlas(self)

True if the source is WordAtlas.

Return type:bool
is_from_wikipedia(self)

True if the source is Wikipedia.

Return type:bool
is_from_wiktionary(self)

True if the source is Wiktionary.

Return type:bool
is_from_wikiquote(self)

True if the source is WikiQuote.

Return type:bool
is_from_omegawiki(self)

True if the source is OmegaWiki.

Return type:bool
is_redirection(self)

True if the source is Wikipedia or Wikiquote redirection.

Return type:bool
is_automatic_translation_from_babelnet(self)

True if the source is the result of automatic machine translation from BabelNet. To cover all kinds of machine translation, please use the more general is_automatic_translation.

Return type:bool
uri(self)

An URI associated with a given language.

Return type:str
is_automatic_translation(self, language)

Return True if the source is the result of automatic machine translation.

Parameters:language (Language) – The language of the source (important to determine if the Open Multilingual WordNet is from manual annotation or not).
Returns:True if the source is the result of automatic machine translation.
Return type:bool
get_license(self, language=None)

Return the license associated with the source for a given language.

Keyword Arguments:
 language (Language) – The source language (default None).
Returns:Source license.
Return type:BabelLicense
BABELNET = (4, 'BabelNet', 'http://babelnet.org')

Lexicalization from BabelNet itself.

WN = (1, 'WordNet', 'http://wordnet.princeton.edu')

Lexicalization from WordNet.

OMWN = (2, 'Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Open Multilingual WordNet.

IWN = (2, 'Italian WordNet', 'https://datahub.io/dataset/iwn')

Lexicalization from Open Multilingual WordNet.

WONEF = (20, 'WordNet du Français', 'http://wonef.fr/')

Lexicalization from WordNet du Francais.

WIKI = (3, 'Wikipedia', 'http://www.wikipedia.org')

Lexicalization from Wikipedia.

WIKIDIS = (4, 'Wikipedia', 'http://www.wikipedia.org')

Lexicalization found in a disambiguation page.

WIKIDATA = (5, 'Wikidata', 'http://www.wikidata.org')

Lexicalization from Wikidata.

OMWIKI = (6, 'OmegaWiki', 'http://www.omegawiki.org')

Lexicalization from OmegaWiki.

WIKICAT = (8, 'Wikipedia', 'http://www.wikipedia.org')

Wikipedia category, not available as of version 3.0.

WIKIRED = (9, 'Wikipedia', 'http://www.wikipedia.org')

Lexicalization from a Wikipedia redirection.

WIKT = (7, 'Wiktionary', 'http://en.wiktionary.org')

Lexicalization from Wiktionary.

WIKIQU = (10, 'Wikiquote', 'http://en.wikiquote.org/wiki/')

Lexicalization found in Wikiquote.

WIKIQUREDI = (11, 'Wikiquote', 'http://en.wikiquote.org/wiki/')

Lexicalization found in Wikiquote redirection.

WIKTLB = (7, 'Wiktionary', 'http://en.wiktionary.org')

Wiktionary translation label.

VERBNET = (13, 'VerbNet', 'http://verbs.colorado.edu/')

Lexicalization found in VerbNet.

FRAMENET = (13, 'FrameNet', 'https://framenet2.icsi.berkeley.edu')

Lexicalization found in FrameNet.

MSTERM = (12, 'Microsoft Terminology', 'https://www.microsoft.com/Language/en-US/Terminology.aspx')

Lexicalization found in Microsoft Terminology.

GEONM = (3, 'GeoNames', 'http://www.geonames.org/')

Lexicalization found in GeoNames.

WNTR = (20, 'Translations')

Lexicalization from an automatic translation of a WordNet concept.

WIKITR = (20, 'Translations')

Lexicalization from an automatic translation of a Wikipedia concept.

MCR_EU = (2, 'Basque Open Multilingual WordNet', 'http://adimen.si.ehu.es/web/MCR/')

Lexicalization from Basque Open Multilingual WordNet.

OMWN_HR = (2, 'Croatian Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Croatian Open Multilingual WordNet.

SLOWNET = (2, 'Slovenian Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Slovenian Open Multilingual WordNet.

OMWN_ID = (2, 'Bahasa Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Bahasa Open Multilingual WordNet.

OMWN_IT = (2, 'Italian Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Italian Open Multilingual WordNet.

MCR_GL = (2, 'Galician Open Multilingual WordNet', 'http://adimen.si.ehu.es/web/MCR/')

Lexicalization from Galician Open Multilingual WordNet.

ICEWN = (2, 'Icelandic (IceWordNet) Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Galician (IceWordNet) Open Multilingual WordNet.

OMWN_ZH = (2, 'Chinese Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Chinese Open Multilingual WordNet.

OMWN_NO = (2, 'Norwegian Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Norwegian Open Multilingual WordNet NOB.

OMWN_NN = (2, 'Norwegian Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Norwegian Open Multilingual WordNet NN.

SALDO = (2, 'Swedish Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Swedish Open Multilingual WordNet.

OMWN_JA = (2, 'Japanese Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Japanese Open Multilingual WordNet.

MCR_CA = (2, 'Catalan Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Catalan Open Multilingual WordNet.

OMWN_PT = (2, 'Portuguese Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Portuguese Open Multilingual WordNet.

OMWN_FI = (2, 'Finnish Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Finnish Open Multilingual WordNet.

OMWN_PL = (2, 'Poland Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Poland Open Multilingual WordNet.

OMWN_TH = (2, 'Thai Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Thai Open Multilingual WordNet.

OMWN_SK = (2, 'Slovak Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Slovak Open Multilingual WordNet.

OMWN_LT = (2, 'Lithuanian Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Lithuanian Open Multilingual WordNet.

OMWN_NL = (2, 'Dutch Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Dutch Open Multilingual WordNet.

OMWN_AR = (2, 'Arabic Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Arabic Open Multilingual WordNet.

OMWN_FA = (2, 'Persian Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Persian Open Multilingual WordNet.

OMWN_EL = (2, 'Greek Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Greek Open Multilingual WordNet.

MCR_ES = (2, 'Spanish Open Multilingual WordNet', 'http://adimen.si.ehu.es/web/MCR/')

Lexicalization from Spanish Open Multilingual WordNet.

OMWN_RO = (2, 'Romanian Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Romanian Open Multilingual WordNet.

OMWN_SQ = (2, 'Albanian (AlbaNet) Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Albanian (AlbaNet) Open Multilingual WordNet.

OMWN_DA = (2, 'Danish (DanNet) Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Danish (DanNet) Open Multilingual WordNet.

OMWN_FR = (2, 'French (WOLF) Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from French (WOLF) Open Multilingual WordNet.

OMWN_MS = (2, 'Bahasa Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Bahasa Open Multilingual WordNet.

OMWN_BG = (2, 'Bulgarian (BulTreeBank) Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Bulgarian (BulTreeBank) Open Multilingual WordNet.

OMWN_HE = (2, 'Hebrew Open Multilingual WordNet', 'http://compling.hss.ntu.edu.sg/omw/#cite:')

Lexicalization from Hebrew Open Multilingual WordNet.

OMWN_KO = (2, 'Korean WordNet', 'http://wordnet.kaist.ac.kr/wordnet_pages/introduction_en.php')

Lexicalization from Korean WordNet.

MCR_PT = (2, 'Portuguese from Multilingual Central Repository', 'http://adimen.si.ehu.es/web/MCR/')

Lexicalization from Portuguese Open Multilingual WordNet.

OMWN_GAE = (2, 'Irish (GAWN) WordNet', 'https://github.com/jimregan/lemonGAWN')

Lexicalization from Irish (GAWN) WordNet.

OMWN_CWN = (2, 'Chinese WordNet', 'http://lope.linguistics.ntu.edu.tw/cwn2/')

Lexicalization from Chinese WordNet.

WORD_ATLAS = (0, 'WordAtlas', 'http://wordatlas.com')

Lexicalization from WordAtlas.

class pybabelnet.data.source.BabelImageSource(*args, **kwds)

Bases: aenum.AutoNumberEnum

Sources for BabelNet images, sorted by priority.

classmethod get_license(cls, source)

Return the license for a given image source.

Parameters:source (BabelImageSource) – Image source.
Returns:The BabelLicense for the image source.
Return type:BabelLicense
BABELNET = 1

BabelNet image.

OMWIKI = 2

OmegaWiki image.

WIKI = 3

Wikipedia image.

IMAGENET = 4

ImageNet image.

WIKIDATA = 5

Wikidata image.

pybabelnet.data.tokens module

Tokens for BabelSense

class pybabelnet.data.tokens.BabelTokenId(start, end, synset_id, word)

Bases: object

Represents the association between the word that appears in a Babel gloss and the BabelSynsetID that identifies the lemma in BabelNet.

Parameters:
  • start (int) – The start position.
  • end (int) – The end position.
  • synset_id (BabelSynsetID) – The id of the BabelSynset.
  • word (str) – The word being annotated.
start

int – Start point of the mention.

end

int – End point of the mention.

synset_id

BabelSynsetID – The id of the sense of the word.

word

str – The lemmatized version of the token’s word.

class pybabelnet.data.tokens.BabelTokenWord(start, end, lemma)

Bases: object

Represents the token unit which can be used to build sentences.

Parameters:
  • start (int) – The start position.
  • end (int) – The end position.
  • lemma (str) – The lemma of the inflected form in the string range.
start

int – Start point of the mention.

end

int – End point of the mention.

lemma

str – The lemmatized version of the token’s word.