presage  0.9.1
Classes | Public Member Functions | Static Public Attributes | Private Attributes | Friends | List of all members
Suggestion Class Reference

#include <suggestion.h>

Collaboration diagram for Suggestion:
Collaboration graph

Classes

class  SuggestionException
 

Public Member Functions

 Suggestion (std::string="", double=0.0)
 
 ~Suggestion ()
 
bool operator== (const Suggestion &) const
 
bool operator!= (const Suggestion &) const
 
bool operator< (const Suggestion &) const
 
std::string getWord () const
 
double getProbability () const
 
void setWord (std::string)
 
void setProbability (double)
 
std::string toString () const
 

Static Public Attributes

static const double MIN_PROBABILITY = 0.0
 
static const double MAX_PROBABILITY = 1.0
 

Private Attributes

std::string word
 
double probability
 

Friends

std::ostream & operator<< (std::ostream &, const Suggestion &)
 

Detailed Description

Suggestion

A suggestion is a prediction token, probability pair.

A prediction token is a string (word or single character). The probability describes how likely the predictor estimated that the associated predicted token is the desired token.

Probability might have to be computed as logarithmic probability to avoid buffer underflows.

Definition at line 49 of file suggestion.h.

Constructor & Destructor Documentation

◆ Suggestion()

Suggestion::Suggestion ( std::string  s = "",
double  p = 0.0 
)

Definition at line 29 of file suggestion.cpp.

References setProbability(), and setWord().

Here is the call graph for this function:

◆ ~Suggestion()

Suggestion::~Suggestion ( )

Definition at line 35 of file suggestion.cpp.

Member Function Documentation

◆ getProbability()

double Suggestion::getProbability ( ) const

Definition at line 68 of file suggestion.cpp.

References probability.

Referenced by Combiner::filter(), and Presage::predict().

Here is the caller graph for this function:

◆ getWord()

std::string Suggestion::getWord ( ) const

Definition at line 63 of file suggestion.cpp.

References word.

Referenced by Combiner::filter(), and Selector::select().

Here is the caller graph for this function:

◆ operator!=()

bool Suggestion::operator!= ( const Suggestion right) const

Definition at line 46 of file suggestion.cpp.

◆ operator<()

bool Suggestion::operator< ( const Suggestion right) const

Definition at line 51 of file suggestion.cpp.

References probability, and word.

◆ operator==()

bool Suggestion::operator== ( const Suggestion right) const

Definition at line 38 of file suggestion.cpp.

References probability, and word.

◆ setProbability()

void Suggestion::setProbability ( double  p)

Definition at line 78 of file suggestion.cpp.

References MIN_PROBABILITY, PRESAGE_INVALID_SUGGESTION_ERROR, probability, and word.

Referenced by Combiner::filter(), RecencyPredictor::predict(), and Suggestion().

Here is the caller graph for this function:

◆ setWord()

void Suggestion::setWord ( std::string  s)

Definition at line 73 of file suggestion.cpp.

References word.

Referenced by RecencyPredictor::predict(), and Suggestion().

Here is the caller graph for this function:

◆ toString()

std::string Suggestion::toString ( ) const

Returns a string representation of this suggestion.

Definition at line 94 of file suggestion.cpp.

References endl(), probability, and word.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  output,
const Suggestion s 
)
friend

Definition at line 102 of file suggestion.cpp.

Member Data Documentation

◆ MAX_PROBABILITY

const double Suggestion::MAX_PROBABILITY = 1.0
static

Definition at line 87 of file suggestion.h.

Referenced by Combiner::filter().

◆ MIN_PROBABILITY

const double Suggestion::MIN_PROBABILITY = 0.0
static

Definition at line 86 of file suggestion.h.

Referenced by setProbability().

◆ probability

double Suggestion::probability
private

◆ word

std::string Suggestion::word
private

Definition at line 100 of file suggestion.h.

Referenced by getWord(), operator<(), operator<<(), operator==(), setProbability(), setWord(), and toString().


The documentation for this class was generated from the following files: