presage
0.9.1
|
#include <suggestion.h>
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 &) |
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.
Suggestion::Suggestion | ( | std::string | s = "" , |
double | p = 0.0 |
||
) |
Definition at line 29 of file suggestion.cpp.
References setProbability(), and setWord().
Suggestion::~Suggestion | ( | ) |
Definition at line 35 of file suggestion.cpp.
double Suggestion::getProbability | ( | ) | const |
Definition at line 68 of file suggestion.cpp.
References probability.
Referenced by Combiner::filter(), and Presage::predict().
std::string Suggestion::getWord | ( | ) | const |
Definition at line 63 of file suggestion.cpp.
References word.
Referenced by Combiner::filter(), and Selector::select().
bool Suggestion::operator!= | ( | const Suggestion & | right | ) | const |
Definition at line 46 of file suggestion.cpp.
bool Suggestion::operator< | ( | const Suggestion & | right | ) | const |
Definition at line 51 of file suggestion.cpp.
References probability, and word.
bool Suggestion::operator== | ( | const Suggestion & | right | ) | const |
Definition at line 38 of file suggestion.cpp.
References probability, and word.
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().
void Suggestion::setWord | ( | std::string | s | ) |
Definition at line 73 of file suggestion.cpp.
References word.
Referenced by RecencyPredictor::predict(), and Suggestion().
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.
|
friend |
Definition at line 102 of file suggestion.cpp.
|
static |
Definition at line 87 of file suggestion.h.
Referenced by Combiner::filter().
|
static |
Definition at line 86 of file suggestion.h.
Referenced by setProbability().
|
private |
Definition at line 101 of file suggestion.h.
Referenced by getProbability(), operator<(), operator<<(), operator==(), setProbability(), and toString().
|
private |
Definition at line 100 of file suggestion.h.
Referenced by getWord(), operator<(), operator<<(), operator==(), setProbability(), setWord(), and toString().