presage
0.9.2~beta
presage
src
lib
predictors
predictor.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_PREDICTOR
26
#define PRESAGE_PREDICTOR
27
28
#include "../core/prediction.h"
29
#include "../core/context_tracker/contextTracker.h"
30
#include "../core/configuration.h"
31
#include "../core/utility.h"
32
33
#include <string>
34
#include <vector>
35
46
class
Predictor
{
47
public
:
48
Predictor
(
Configuration
*
configuration
,
49
ContextTracker
*
contextTracker
,
50
const
char
* predictorName =
"Predictor"
,
51
const
char
*
shortDescription
=
""
,
52
const
char
*
longDescription
=
""
);
53
virtual
~Predictor
();
54
61
virtual
Prediction
predict
(
const
size_t
size,
const
char
** filter)
const
= 0;
62
63
virtual
void
learn
(
const
std::vector<std::string>& change) = 0;
64
65
const
std::string
getName
()
const
;
66
const
std::string
getShortDescription
()
const
;
67
const
std::string
getLongDescription
()
const
;
68
69
70
protected
:
71
virtual
bool
token_satisfies_filter
(
const
std::string& token,
72
const
std::string& prefix,
73
const
char
** filter)
const
;
74
75
virtual
void
set_logger
(
const
std::string& level);
76
77
const
std::string
name
;
78
const
std::string
shortDescription
;
// predictor's descriptive name
79
const
std::string
longDescription
;
// predictor's exhaustive description
80
81
const
std::string
PREDICTORS
;
82
83
ContextTracker
*
contextTracker
;
84
85
Configuration
*
configuration
;
86
87
Logger<char>
logger
;
88
89
private
:
90
91
};
92
93
94
#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::getName
const std::string getName() const
Definition:
predictor.cpp:66
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
Configuration
Definition:
configuration.h:36
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::~Predictor
virtual ~Predictor()
Definition:
predictor.cpp:60
Predictor::getShortDescription
const std::string getShortDescription() const
Definition:
predictor.cpp:74
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::getLongDescription
const std::string getLongDescription() const
Definition:
predictor.cpp:82
Generated on Wed Nov 28 2018 12:12:14 for presage by
1.8.14