class documentation

class BabelSynsetGlossComparator:

View In Hierarchy

Comparator for BabelSynset.

It does the following:

  • sorts Babel synsets using their glosses number
  • sorts using BabelSynsetComparator
Method __init__ init method
Method compare Compare two BabelSynsets
Static Method _compare_by_gloss_then_main_sense A comparator function that first compares two synset using the gloss and then using the main sense
Instance Variable _language The langage to use
Instance Variable _word the word to use for the comparation.
def __init__(self, word, language=Language.EN):

init method

Parameters
word:strThe word whose sense numbers are used to sort the BabelSynsets corresponding to WordNet synsets.
language:LanguageThe language used to sort senses (default Language.EN).
def compare(self, b1, b2):

Compare two BabelSynsets

Parameters
b1:BabelSynsetFirst BabelSynset.
b2:BabelSynsetSecond BabelSynset.
Returns
intCompare result.
Raises
NotImplementedIf b1 xor b2 are not instance of BabelSynset
@staticmethod
def _compare_by_gloss_then_main_sense(b1, b2):

A comparator function that first compares two synset using the gloss and then using the main sense

Parameters
b1:BabelSynsetFirst BabelSynset.
b2:BabelSynsetSecond BabelSynset.
Returns
intCompare result.
_language: Language =

The langage to use

_word: str =

the word to use for the comparation.