presage
0.9.2~beta
|
#include <prediction.h>
Public Member Functions | |
Prediction () | |
~Prediction () | |
const Prediction & | operator= (const Prediction &) |
bool | operator== (const Prediction &) const |
size_t | size () const |
Suggestion | getSuggestion (int=0) const |
Suggestion | getSuggestion (std::string token) const |
void | addSuggestion (Suggestion) |
std::string | toString () const |
Private Attributes | |
std::vector< Suggestion > | suggestions |
Friends | |
std::ostream & | operator<< (std::ostream &, const Prediction &) |
A prediction contains a set of Suggestion objects. More precisely, a Prediction is a list of Suggestion object, ordered by decreasing probability.
A Prediction object is returned by the predictors and by a combiner object.
Definition at line 47 of file prediction.h.
Prediction::Prediction | ( | ) |
Definition at line 28 of file prediction.cpp.
Prediction::~Prediction | ( | ) |
Definition at line 31 of file prediction.cpp.
void Prediction::addSuggestion | ( | Suggestion | s | ) |
Inserts a new suggestion, preserves the ordering.
The suggestion object to be inserted is compared against the suggestions already contained in the prediction and inserted in an ordered fashion.
Comparison between suggestion objects uses the overloaded operator<
Definition at line 90 of file prediction.cpp.
References suggestions.
Referenced by MeritocracyCombiner::combine(), Combiner::filter(), PredictorActivator::parse_internal_commands(), DummyPredictor::predict(), DictionaryPredictor::predict(), DejavuPredictor::predict(), AbbreviationExpansionPredictor::predict(), SmoothedNgramPredictor::predict(), RecencyPredictor::predict(), and ARPAPredictor::predict().
Suggestion Prediction::getSuggestion | ( | int | i = 0 | ) | const |
Returns nth most probable suggestion.
Definition at line 73 of file prediction.cpp.
References suggestions.
Referenced by Combiner::filter(), operator==(), Presage::predict(), and Selector::select().
Suggestion Prediction::getSuggestion | ( | std::string | token | ) | const |
Returns suggestion with given token.
Definition at line 80 of file prediction.cpp.
References suggestions.
const Prediction & Prediction::operator= | ( | const Prediction & | right | ) |
Definition at line 34 of file prediction.cpp.
References suggestions.
bool Prediction::operator== | ( | const Prediction & | right | ) | const |
Predictions are equal iff suggestions are equal and in same order.
Definition at line 45 of file prediction.cpp.
References getSuggestion(), and size().
size_t Prediction::size | ( | ) | const |
Returns number of suggestions in prediction.
Definition at line 68 of file prediction.cpp.
References suggestions.
Referenced by Combiner::filter(), operator==(), RecencyPredictor::predict(), Presage::predict(), and Selector::select().
std::string Prediction::toString | ( | ) | const |
Returns a string representation of the prediction.
Definition at line 106 of file prediction.cpp.
References suggestions.
|
friend |
Definition at line 116 of file prediction.cpp.
|
private |
Definition at line 87 of file prediction.h.
Referenced by addSuggestion(), getSuggestion(), operator<<(), operator=(), size(), and toString().