presage 0.9.1
predictorActivator.h
Go to the documentation of this file.
1
2/******************************************************
3 * Presage, an extensible predictive text entry system
4 * ---------------------------------------------------
5 *
6 * Copyright (C) 2008 Matteo Vescovi <matteo.vescovi@yahoo.co.uk>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 **********(*)*/
23
24
25#ifndef PRESAGE_PREDICTORACTIVATOR
26#define PRESAGE_PREDICTORACTIVATOR
27
28#ifdef HAVE_CONFIG_H
29# include "config.h"
30#endif
31
32#include "configuration.h"
33#include "predictorRegistry.h"
35#include "prediction.h"
36#include "logger.h"
37#include "dispatcher.h"
38
39#include "combiner.h"
40#include "meritocracyCombiner.h"
41
43
44
45#ifdef STDC_HEADERS
46# include <stdlib.h> // needed for abort function
47#endif
48
49
63public:
64//PLUMP PredictorActivator(HistoryTracker&,
65//PLUMP plump::Plump&);
66
78
83
92 Prediction predict(unsigned int multiplier, const char** filter);
93
101 int getPredictTime() const;
102
108 void setPredictTime(const std::string& predictTime);
109
118 std::string getCombinationPolicy() const;
119
131 void setCombinationPolicy(const std::string& policy);
132
137 void setMaxPartialPredictionSize (const std::string& size);
138
143 void setLogger (const std::string& level);
144
146
147 virtual void update (const Observable* variable);
148
149 static const char* LOGGER;
150 static const char* PREDICT_TIME;
151 static const char* MAX_PARTIAL_PREDICTION_SIZE;
152 static const char* COMBINATION_POLICY;
153
154private:
155 // execute predictor function (invoked in thread)
156 void *execute(void *);
157
158
162
164
166 std::string combinationPolicy;
167
169
170 std::vector<Prediction> predictions; // predictions computed by each predictor are returned here
171
173
175};
176
177#endif // PRESAGE_PREDICTORACTIVATOR
Tracks user interaction and context.
void setMaxPartialPredictionSize(const std::string &size)
void parse_internal_commands(Prediction &pred)
void setPredictTime(const std::string &predictTime)
std::string getCombinationPolicy() const
PredictorActivator(Configuration *config, PredictorRegistry *registry, ContextTracker *contextTracker)
ContextTracker * contextTracker
std::string combinationPolicy
static const char * MAX_PARTIAL_PREDICTION_SIZE
void setCombinationPolicy(const std::string &policy)
Dispatcher< PredictorActivator > dispatcher
static const char * LOGGER
virtual void update(const Observable *variable)
static const char * PREDICT_TIME
PredictorRegistry * predictorRegistry
void setLogger(const std::string &level)
void * execute(void *)
std::vector< Prediction > predictions
Prediction predict(unsigned int multiplier, const char **filter)
static const char * COMBINATION_POLICY
Configuration * config