flitsr.ranking.Ranking

class flitsr.ranking.Ranking(tiebrk: Tiebrk = Tiebrk.ORIG)

Bases: object

A singular ranking, containing ranked Spectrum.Entity.

__init__(tiebrk: Tiebrk = Tiebrk.ORIG)

Methods

__init__([tiebrk])

append(entity, score, exec_count)

Append the given entity to the ranking, with the given score and execution count exec_count.

extend(ranks)

Extend this Ranking by adding all Rank in the List ranks.

get_rank(entity[, check_sub_group])

Return the Rank of the given Spectrum.Entity.

has_entity(entity)

Return whether this Ranking contains the given entity.

sort(reverse)

Re-sort this Ranking in-place by their scores, using the Tiebrk method set.

append(entity: Entity, score: float, exec_count: int)

Append the given entity to the ranking, with the given score and execution count exec_count.

Parameters:
  • entity – Spectrum.Entity: The entity to append to this Ranking.

  • score – float: The score of the given entity.

  • exec_count – int: The execution count of the given entity.

extend(ranks: List[Rank])

Extend this Ranking by adding all Rank in the List ranks.

Parameters:

ranks – List[Rank]: The List of ranks to add to this Ranking.

get_rank(entity: Entity, check_sub_group=False) Rank

Return the Rank of the given Spectrum.Entity. If the check_sub_group option is given, try to find if the given entity is contained within another group in the ranking (either as a sub-group or as an element).

Parameters:
  • entity – Spectrum.Entity: The entity to return the rank for

  • check_sub_group – (Default value = False) Whether to check for the

  • ranking. (entity as a subgroup of entities in the)

Returns:

The Rank of the given entity.

has_entity(entity: Entity) bool

Return whether this Ranking contains the given entity. Does not check if the entity is a subgroup.

Parameters:

entity – Spectrum.Entity: The entity to check for.

Returns:

True if entity is directly in this Ranking, False otherwise.

sort(reverse: bool)

Re-sort this Ranking in-place by their scores, using the Tiebrk method set.

Parameters:

reverse – bool: Whether to sort by reverse order of scores.