recencyPredictor.h
Go to the documentation of this file.
/******************************************************
* Presage, an extensible predictive text entry system
* ---------------------------------------------------
*
* Copyright (C) 2008 Matteo Vescovi <matteo.vescovi@yahoo.co.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
**********(*)*/
#ifndef PRESAGE_RECENCYPREDICTOR
#define PRESAGE_RECENCYPREDICTOR
#include "predictor.h"
#include "../core/logger.h"
#include "../core/dispatcher.h"
class RecencyPredictor : public Predictor, public Observer {
public:
RecencyPredictor (Configuration*, ContextTracker*, const char*);
~RecencyPredictor();
virtual Prediction predict (const size_t size, const char** filter) const;
virtual void learn (const std::vector<std::string>& change);
virtual void update (const Observable* variable);
private:
void set_lambda (const std::string& value);
void set_n_0 (const std::string& value);
void set_cutoff_threshold (const std::string& value);
std::string LOGGER;
std::string LAMBDA;
std::string N_0;
std::string CUTOFF_THRESHOLD;
double lambda;
double n_0;
size_t cutoff_threshold;
Dispatcher<RecencyPredictor> dispatcher;
};
#endif // PRESAGE_RECENCYPREDICTOR
predictor.h
Prediction
Definition: prediction.h:47
Dispatcher< RecencyPredictor >
Predictor
Definition: predictor.h:46
RecencyPredictor::set_cutoff_threshold
void set_cutoff_threshold(const std::string &value)
Definition: recencyPredictor.cpp:72
RecencyPredictor::update
virtual void update(const Observable *variable)
Definition: recencyPredictor.cpp:129
RecencyPredictor::CUTOFF_THRESHOLD
std::string CUTOFF_THRESHOLD
Definition: recencyPredictor.h:83
RecencyPredictor
Definition: recencyPredictor.h:64
RecencyPredictor::predict
virtual Prediction predict(const size_t size, const char **filter) const
Generate prediction.
Definition: recencyPredictor.cpp:79
RecencyPredictor::cutoff_threshold
size_t cutoff_threshold
Definition: recencyPredictor.h:87
RecencyPredictor::LOGGER
std::string LOGGER
Definition: recencyPredictor.h:80
RecencyPredictor::lambda
double lambda
Definition: recencyPredictor.h:85
RecencyPredictor::~RecencyPredictor
~RecencyPredictor()
Definition: recencyPredictor.cpp:54
RecencyPredictor::n_0
double n_0
Definition: recencyPredictor.h:86
RecencyPredictor::LAMBDA
std::string LAMBDA
Definition: recencyPredictor.h:81
RecencyPredictor::set_lambda
void set_lambda(const std::string &value)
Definition: recencyPredictor.cpp:59
RecencyPredictor::dispatcher
Dispatcher< RecencyPredictor > dispatcher
Definition: recencyPredictor.h:89
Observer
Definition: observer.h:34
RecencyPredictor::N_0
std::string N_0
Definition: recencyPredictor.h:82
Configuration
Definition: configuration.h:36
RecencyPredictor::set_n_0
void set_n_0(const std::string &value)
Definition: recencyPredictor.cpp:65
RecencyPredictor::RecencyPredictor
RecencyPredictor(Configuration *, ContextTracker *, const char *)
Definition: recencyPredictor.cpp:29
RecencyPredictor::learn
virtual void learn(const std::vector< std::string > &change)
Definition: recencyPredictor.cpp:126
ContextTracker
Tracks user interaction and context.
Definition: contextTracker.h:155
Observable
Definition: observable.h:37