predictor.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_PREDICTOR
#define PRESAGE_PREDICTOR
#include "../core/prediction.h"
#include "../core/context_tracker/contextTracker.h"
#include "../core/configuration.h"
#include "../core/utility.h"
#include <string>
#include <vector>
class Predictor {
public:
Predictor(Configuration* configuration,
ContextTracker* contextTracker,
const char* predictorName = "Predictor",
const char* shortDescription = "",
const char* longDescription = "");
virtual ~Predictor();
virtual Prediction predict(const size_t size, const char** filter) const = 0;
virtual void learn(const std::vector<std::string>& change) = 0;
const std::string getName() const;
const std::string getShortDescription() const;
const std::string getLongDescription() const;
protected:
virtual bool token_satisfies_filter (const std::string& token,
const std::string& prefix,
const char** filter) const;
virtual void set_logger (const std::string& level);
const std::string name;
const std::string shortDescription; // predictor's descriptive name
const std::string longDescription; // predictor's exhaustive description
const std::string PREDICTORS;
ContextTracker* contextTracker;
Configuration* configuration;
Logger<char> logger;
private:
};
#endif // PRESAGE_PREDICTOR
Logger< char >
Predictor::logger
Logger< char > logger
Definition: predictor.h:87
Prediction
Definition: prediction.h:47
Predictor::configuration
Configuration * configuration
Definition: predictor.h:85
Predictor
Definition: predictor.h:46
Predictor::getShortDescription
const std::string getShortDescription() const
Definition: predictor.cpp:74
Predictor::predict
virtual Prediction predict(const size_t size, const char **filter) const =0
Generate prediction.
Predictor::set_logger
virtual void set_logger(const std::string &level)
Definition: predictor.cpp:88
Predictor::learn
virtual void learn(const std::vector< std::string > &change)=0
Predictor::PREDICTORS
const std::string PREDICTORS
Definition: predictor.h:81
Predictor::longDescription
const std::string longDescription
Definition: predictor.h:79
Predictor::name
const std::string name
Definition: predictor.h:77
Predictor::Predictor
Predictor(Configuration *configuration, ContextTracker *contextTracker, const char *predictorName="Predictor", const char *shortDescription="", const char *longDescription="")
Definition: predictor.cpp:39
Predictor::getLongDescription
const std::string getLongDescription() const
Definition: predictor.cpp:82
Configuration
Definition: configuration.h:36
Predictor::token_satisfies_filter
virtual bool token_satisfies_filter(const std::string &token, const std::string &prefix, const char **filter) const
Definition: predictor.cpp:95
Predictor::contextTracker
ContextTracker * contextTracker
Definition: predictor.h:83
Predictor::shortDescription
const std::string shortDescription
Definition: predictor.h:78
ContextTracker
Tracks user interaction and context.
Definition: contextTracker.h:155
Predictor::getName
const std::string getName() const
Definition: predictor.cpp:66
Predictor::~Predictor
virtual ~Predictor()
Definition: predictor.cpp:60