module documentation

A BabelNet utility module. Mainly for internal use.

Class UnsupportedOnlineError Exception raised when is used a feature unavailable in the online API
Function cmp Old school comparator function.
Function comparator Decorator that turns a class in a Java style comparator, in order to use inheritance and custom arguments for sorting. The class needs to declare a compare(obj1, obj2) method that returns an int.
Function flatten_to_ascii Transliterate input string to ascii.
Function flatten_to_ascii_light Transliterate input string to ascii using unicodedata.
Function java_split A version of the split that behaves like the java one.
Function lemma_to_string Cleans up a full lemma. It filters the input by removing the annotations inside the parenthesis at the end of the lemma (if present)
Function normalized_lemma_to_string Normalizes a full lemma. It filters the input by removing the annotations inside the parenthesis at the end of the lemma (if present) and converts it to lowercase.
def cmp(a, b):

Old school comparator function.

Parameters
athe first object to compare
bthe second object to compare
def comparator(cls):

Decorator that turns a class in a Java style comparator, in order to use inheritance and custom arguments for sorting. The class needs to declare a compare(obj1, obj2) method that returns an int.

def flatten_to_ascii(string):

Transliterate input string to ascii.

Parameters
string:strThe input string.
Returns
strstr
def flatten_to_ascii_light(string):

Transliterate input string to ascii using unicodedata.

Parameters
string:strThe input string.
Returns
Optional[str]the flattened version of the input string
def java_split(string, char):

A version of the split that behaves like the java one.

Parameters
string:strthe string to split
char:strthe character to use for splitting
Returns
Sequence[str]the initial string split in a sequence.
def lemma_to_string(lemma):

Cleans up a full lemma. It filters the input by removing the annotations inside the parenthesis at the end of the lemma (if present)

Parameters
lemma:strthe input lemma
Returns
strthe simple string
def normalized_lemma_to_string(lemma):

Normalizes a full lemma. It filters the input by removing the annotations inside the parenthesis at the end of the lemma (if present) and converts it to lowercase.

Parameters
lemma:strthe input simpleLemma
Returns
strthe string