class documentation

class _InternalBabelSynsetComparator:

Known subclasses: babelnet.synset.BabelSynsetComparator

View In Hierarchy

Comparator for BabelSynsets that

  • puts WordNet synsets first;
  • sorts WordNet synsets based on the sense number of a specific input word (see the constructor);
  • sorts Wikipedia synsets based on their degree and lexicographically based on their main sense
Method __init__ init method
Method compare Compare two BabelSynset(s)
Class Method _valid_degree Get a valid degree from the given BabelSynset
Static Method _compare_by_edge_then_main_sense Compare two BabelSynset based on the edges and then on the man sense.
Instance Variable _language the language to use for the comparation
Instance Variable _word the word to use for the comparation
def __init__(self, word=None, language=Language.EN):

init method

Parameters
word:Optional[str]the word to set for this instance of the comparator. It will be used to compare synsets based on the correlation with this word (default None).
language:Languagethe language to use for the comparation.
def compare(self, b1, b2):

Compare two BabelSynset(s)

Parameters
b1:BabelSynsetFirst BabelSynset.
b2:BabelSynsetSecond BabelSynset.
Returns
intCompare result.
@classmethod
def _valid_degree(self, bs):

Get a valid degree from the given BabelSynset

Parameters
bs:BabelSynsetthe BabelSynset.
Returns
inta valid degree for the given synset
@staticmethod
def _compare_by_edge_then_main_sense(b1, b2):

Compare two BabelSynset based on the edges and then on the man sense.

Parameters
b1:BabelSynsetFirst BabelSynset.
b2:BabelSynsetSecond BabelSynset.
Returns
intthe result of the comparation.
_language: Language =

the language to use for the comparation

_word: str =

the word to use for the comparation