33 "RecencyPredictor, a statistical recency promotion predictor",
34 "RecencyPredictor, based on a recency promotion principle, generates predictions by assigning exponentially decaying probability values to previously encountered tokens. Tokens are assigned a probability value that decays exponentially with their distance from the current token, thereby promoting context recency." ),
75 logger << INFO <<
"CUTOFF_THRESHOLD: " << value <<
endl;
84 logger << INFO <<
"prefix: " << prefix <<
endl;
85 if (!prefix.empty()) {
98 && result.
size() < max
103 if (token.find(prefix) == 0) {
109 prob =
n_0 * exp(-(
lambda * (index - 1)));
110 logger << INFO <<
"probability: " << prob <<
endl;
static int toInt(const std::string)
void dispatch(const Observable *var)
void set_cutoff_threshold(const std::string &value)
virtual void update(const Observable *variable)
std::string CUTOFF_THRESHOLD
virtual Prediction predict(const size_t size, const char **filter) const
Generate prediction.
void setProbability(double)
virtual void set_logger(const std::string &level)
void set_lambda(const std::string &value)
const std::string PREDICTORS
static double toDouble(const std::string)
Dispatcher< RecencyPredictor > dispatcher
virtual std::string get_name() const =0
void set_n_0(const std::string &value)
void map(Observable *var, const mbr_func_ptr_t &ptr)
ContextTracker * contextTracker
RecencyPredictor(Configuration *, ContextTracker *, const char *)
void setWord(std::string)
void addSuggestion(Suggestion)
virtual void learn(const std::vector< std::string > &change)
Tracks user interaction and context.
virtual std::string get_value() const =0
std::string getPrefix() const
virtual bool token_satisfies_filter(const std::string &token, const std::string &prefix, const char **filter) const
const Logger< _charT, _Traits > & endl(const Logger< _charT, _Traits > &lgr)
std::string getToken(const int) const