presage  0.9.2~beta
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 50 of file suggestion.h.

Constructor & Destructor Documentation

◆ Suggestion()

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

Definition at line 30 of file suggestion.cpp.

References setProbability(), and setWord().

Here is the call graph for this function:

◆ ~Suggestion()

Suggestion::~Suggestion ( )

Definition at line 36 of file suggestion.cpp.

Member Function Documentation

◆ getProbability()

double Suggestion::getProbability ( ) const

Definition at line 69 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 64 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 47 of file suggestion.cpp.

◆ operator<()

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

Definition at line 52 of file suggestion.cpp.

References probability, and word.

◆ operator==()

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

Definition at line 39 of file suggestion.cpp.

References probability, and word.

◆ setProbability()

void Suggestion::setProbability ( double  p)

Definition at line 79 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 74 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 95 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 103 of file suggestion.cpp.

Member Data Documentation

◆ MAX_PROBABILITY

const double Suggestion::MAX_PROBABILITY = 1.0
static

Definition at line 69 of file suggestion.h.

Referenced by Combiner::filter().

◆ MIN_PROBABILITY

const double Suggestion::MIN_PROBABILITY = 0.0
static

Definition at line 68 of file suggestion.h.

Referenced by setProbability().

◆ probability

double Suggestion::probability
private

Definition at line 83 of file suggestion.h.

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

◆ word

std::string Suggestion::word
private

Definition at line 82 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: