tipy :: prdct :: Suggestion :: Class Suggestion
[hide private]
[frames] | no frames]

Class Suggestion

source code

object --+
         |
        Suggestion

A suggestion consists of a string and a probility.

The string is in fact a token and the probability is the probability associated to this token by the predictor which compute it. The probability reflect how accurate the word is over prediction.

Class Hierarchy for Suggestion
Class Hierarchy for Suggestion

Instance Methods [hide private]
 
__init__(self, word, probability)
Suggestion creator
source code
bool
__eq__(self, other)
Override the == operator in order to compare instances equality.
source code
bool
__lt__(self, other)
Override the < operator in order to compare instances.
source code
bool
__gt__(self, other)
Override the > operator in order to compare instances.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, word, probability)
(Constructor)

source code 

Suggestion creator

A suggestion is a couple formed by a suggested word and its probability.

Parameters:
  • word (str) - The suggested word.
  • probability (float) - The suggested word probability. It is compute by the predictors.
Overrides: object.__init__

Note: the probabilities of each predictors should have the same weight. Otherwise the suggestion selection will be truncated.

__eq__(self, other)
(Equality operator)

source code 

Override the == operator in order to compare instances equality.

Two Suggestion instances are equal if their word and probability are equal.

Parameters:
  • other (Suggestion) - The Suggestion instance to compare to this one (self).
Returns: bool
True if the two instances are equal, False otherwise.

__lt__(self, other)
(Less-than operator)

source code 

Override the < operator in order to compare instances.

A Suggestion instance is less than another if its probability is less than the probability of the other. If their probabilities are equal then the Suggestion instance is less than the other if its word is alphabetically 'before' the word of the other instance.

Parameters:
  • other (Suggestion) - The Suggestion instance to compare to this one (self).
Returns: bool
True if the this instance (self) is less than the other one, False otherwise.

__gt__(self, other)
(Greater-than operator)

source code 

Override the > operator in order to compare instances.

A Suggestion instance is greater than another if its probability is greater than the probability of the other. If their probabilities are equal then the Suggestion instance is greater than the other if its word is alphabetically 'after' the word of the other instance.

Parameters:
  • other (Suggestion) - The Suggestion instance to compare to this one (self).
Returns: bool
True if the this instance (self) is greater than the other one, False otherwise.