presage
0.9.2~beta
|
#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 50 of file suggestion.h.
Suggestion::Suggestion | ( | std::string | s = "" , |
double | p = 0.0 |
||
) |
Definition at line 30 of file suggestion.cpp.
References setProbability(), and setWord().
Suggestion::~Suggestion | ( | ) |
Definition at line 36 of file suggestion.cpp.
double Suggestion::getProbability | ( | ) | const |
Definition at line 69 of file suggestion.cpp.
References probability.
Referenced by Combiner::filter(), and Presage::predict().
std::string Suggestion::getWord | ( | ) | const |
Definition at line 64 of file suggestion.cpp.
References word.
Referenced by Combiner::filter(), and Selector::select().
bool Suggestion::operator!= | ( | const Suggestion & | right | ) | const |
Definition at line 47 of file suggestion.cpp.
bool Suggestion::operator< | ( | const Suggestion & | right | ) | const |
Definition at line 52 of file suggestion.cpp.
References probability, and word.
bool Suggestion::operator== | ( | const Suggestion & | right | ) | const |
Definition at line 39 of file suggestion.cpp.
References probability, and word.
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().
void Suggestion::setWord | ( | std::string | s | ) |
Definition at line 74 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 95 of file suggestion.cpp.
References endl(), probability, and word.
|
friend |
Definition at line 103 of file suggestion.cpp.
|
static |
Definition at line 69 of file suggestion.h.
Referenced by Combiner::filter().
|
static |
Definition at line 68 of file suggestion.h.
Referenced by setProbability().
|
private |
Definition at line 83 of file suggestion.h.
Referenced by getProbability(), operator<(), operator<<(), operator==(), setProbability(), and toString().
|
private |
Definition at line 82 of file suggestion.h.
Referenced by getWord(), operator<(), operator<<(), operator==(), setProbability(), setWord(), and toString().