class documentation

class BabelAudio:

View In Hierarchy

An audio item in BabelNet.

Static Method get_response_code Get the response code for an input URL string.
Method __init__ init method
Instance Variable filename Audio filename associated.
Instance Variable language Lemma language.
Instance Variable lemma Lemma pronounced.
Property url The full URL of this BabelAudio.
Property validated_url A valid URL for the audio file.
Class Method _test_url_exists Check whether a given URL exists, namely whether it does return a 404 error code.
Method __eq__ Undocumented
Method __hash__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
Method _create_url Create a full-fledged URL.
Method _retrieve_url Retrieve an url
Constant _HTTP_PREFIX HTTP prefix (str).
Constant _REG Regular expression (str).
Constant _URL_COMMOS Wikimedia Commons URL (str).
Constant _URL_PREFIX The default audio URL (str).
Instance Variable _url the url
Instance Variable _url_validated the validated url
@staticmethod
def get_response_code(url_string):

Get the response code for an input URL string.

Parameters
url_string:strThe URL string.
Returns
intThe response code for an input URL.
def __init__(self, lemma, language, filename):

init method

Parameters
lemma:strLemma pronounced.
language:LanguageLemma language.
filename:strAudio filename associated.
filename: str =

Audio filename associated.

language: Language =

Lemma language.

lemma: str =

Lemma pronounced.

@property
url: str =

The full URL of this BabelAudio.

@property
validated_url: str =

A valid URL for the audio file.

@classmethod
def _test_url_exists(cls, url_string):

Check whether a given URL exists, namely whether it does return a 404 error code.

Parameters
url_string:strthe url to check
Returns
booltrue if it exists, false otherwise.
def __eq__(self, other):

Undocumented

def __hash__(self):

Undocumented

def __repr__(self):

Undocumented

def __str__(self):

Undocumented

def _create_url(self):

Create a full-fledged URL.

Returns
strthe url
def _retrieve_url(self):

Retrieve an url

Returns
strthe url
_HTTP_PREFIX: str =

HTTP prefix (str).

Value
'http:'
_REG: str =

Regular expression (str).

Value
'//upload.wikimedia.org/wikipedia/commons/.*?'
_URL_COMMOS: str =

Wikimedia Commons URL (str).

Value
'http://commons.wikimedia.org/wiki/'
_URL_PREFIX: str =

The default audio URL (str).

Value
'//upload.wikimedia.org/wikipedia/commons/'
_url: str =

the url

_url_validated: str =

the validated url