presage
0.8.8
Main Page
Classes
Files
File List
File Members
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
Generated on Thu Nov 7 2013 14:39:06 for presage by
1.8.4