class documentation

class BabelSense:

Known subclasses: babelnet.sense.WordNetSense

View In Hierarchy

A sense in BabelNet, contained in a BabelSynset.

Method __init__ init method
Method synset.setter Set the synset the sense belongs to.
Method to_uri Return the URI of the sense for a given ExternalResource.
Instance Variable full_lemma The full lemma for this sense.
Instance Variable id The id of the sense in the SQL database.
Instance Variable language The language of this sense.
Instance Variable normalized_lemma The normalized lemma for this sense (lowercase, without parentheses, etc.).
Instance Variable pos The part-of-speech of this sense.
Instance Variable pronunciations The set of the audio pronunciations.
Instance Variable sensekey Undocumented
Instance Variable source The source of this lemma: WordNet, Wikipedia, translation, etc.
Instance Variable synset_id The synset id this sense belongs to.
Property is_automatic_translation True if the sense is the result of an automatic translation.
Property is_key_sense True if it is a key sense.
Property is_not_automatic_translation Returns True if the sense is NOT the result of an automatic translation.
Property lemma Get the lemma of this BabelSense
Property license The license for this Babel sense.
Property sense_str A String-based representation of this BabelSense alternative to the "canonical" one obtained using __str__. This corresponds to a diesis-like representation if the sense belongs to WordNet, e.g. 'car#n#1'...
Property synset The synset the sense belongs to.
Method __eq__ Undocumented
Method __hash__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
Method _get_dbpedia_uri Get a link to the corresponding DBPedia URI (None if no interlinking is available or possible).
Method _get_geonames_uri Get a link to the corresponding GeoNames URI (None if no interlinking is available or possible).
Method _get_yago_uri Get a link to the corresponding YAGO URI (None if no interlinking is available or possible).
Constant _DBPEDIA_PREFIX The prefix of DBPedia URIs.
Constant _YAGO_PREFIX The prefix of YAGO3 URIs.
Instance Variable _key_sense The sensekey of the OmegaWiki, Wikidata, Wiktionary, GeoName, MSTERM or VerbNet sense to which this sense corresponds, if any.
Instance Variable _lemma the lemma
Instance Variable _synset The synset this sense belongs to.
Instance Variable _yago_url the yago url
def __init__(self, lemma, language, pos, source, sensekey, synset, *, key_sense=False, yago_url=None, phonetics=None):

init method

Parameters
lemma:strThe full lemma for this sense.
language:LanguageThe language of this sense.
pos:POSThe part-of-speech of this sense.
source:BabelSenseSourceThe source of this lemma: WordNet, Wikipedia, translation, etc.
sensekey:strThe sensekey of the OmegaWiki, Wikidata, Wiktionary, GeoName, MSTERM or VerbNet sense to which this sense corresponds, if any.
synset:BabelSynsetThe synset this sense belongs to.
key_sense:boolTrue if it is a key sense (default False).
yago_url:strA link to the corresponding YAGO URI (default None).
phonetics:BabelSensePhoneticsThe set of the audio pronunciations (default None.
@synset.setter
def synset(self, value):

Set the synset the sense belongs to.

Parameters
value:BabelSynsetThe synset the sense belongs to.
def to_uri(self, resource):

Return the URI of the sense for a given ExternalResource.

Parameters
resource:BabelExternalResourceThe external resource.
Returns
Optional[str]The URI to the external resource.
full_lemma: str =

The full lemma for this sense.

id: int =

The id of the sense in the SQL database.

language: Language =

The language of this sense.

normalized_lemma =

The normalized lemma for this sense (lowercase, without parentheses, etc.).

pos: POS =

The part-of-speech of this sense.

pronunciations: Optional[BabelSensePhonetics] =

The set of the audio pronunciations.

sensekey: str =

Undocumented

source: BabelSenseSource =

The source of this lemma: WordNet, Wikipedia, translation, etc.

synset_id =

The synset id this sense belongs to.

@property
is_automatic_translation: bool =

True if the sense is the result of an automatic translation.

@property
is_key_sense: bool =

True if it is a key sense.

@property
is_not_automatic_translation: bool =

Returns True if the sense is NOT the result of an automatic translation.

@property
lemma: BabelLemma =

Get the lemma of this BabelSense

@property
license: BabelLicense =

The license for this Babel sense.

@property
sense_str: bool =

A String-based representation of this BabelSense alternative to the "canonical" one obtained using __str__. This corresponds to a diesis-like representation if the sense belongs to WordNet, e.g. 'car#n#1' or 'funk#n#3', or the page otherwise the lemma.

@property
synset: BabelSynset =

The synset the sense belongs to.

def __eq__(self, other):

Undocumented

def __hash__(self):

Undocumented

def __repr__(self):

Undocumented

def __str__(self):

Undocumented

def _get_dbpedia_uri(self):

Get a link to the corresponding DBPedia URI (None if no interlinking is available or possible).

See also: DBPedia interlinking

Returns
Optional[str]A link to the corresponding DBPedia URI.
def _get_geonames_uri(self):

Get a link to the corresponding GeoNames URI (None if no interlinking is available or possible).

See also: `GeoNames <http://www.geonames.org/>`_

Returns
Optional[str]A link to the corresponding GeoNames URI.
def _get_yago_uri(self):

Get a link to the corresponding YAGO URI (None if no interlinking is available or possible).

See also: YAGO

Returns
Optional[str]A link to the corresponding YAGO URI.
_DBPEDIA_PREFIX: str =

The prefix of DBPedia URIs.

Value
'http://dbpedia.org/resource/'
_YAGO_PREFIX: str =

The prefix of YAGO3 URIs.

Value
'http://yago-knowledge.org/resource/'
_key_sense =

The sensekey of the OmegaWiki, Wikidata, Wiktionary, GeoName, MSTERM or VerbNet sense to which this sense corresponds, if any.

_lemma: str =

the lemma

_synset =

The synset this sense belongs to.

_yago_url =

the yago url