presage  0.9.1
dictionaryPredictor.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_DICTIONARYPREDICTOR
26 #define PRESAGE_DICTIONARYPREDICTOR
27 
28 #include "predictor.h"
29 #include "../core/dispatcher.h"
30 
31 #include <fstream>
32 
33 
40 class DictionaryPredictor : public Predictor, public Observer {
41 public:
44 
45  virtual Prediction predict (const size_t size, const char** filter) const;
46 
47  virtual void learn (const std::vector<std::string>& change);
48 
49  virtual void update (const Observable* variable);
50 
51  void set_dictionary (const std::string& value);
52  void set_probability (const std::string& value);
53 
54 private:
55  std::string LOGGER;
56  std::string DICTIONARY;
57  std::string PROBABILITY;
58 
59  std::string dictionary_path;
60  double probability;
61 
63 };
64 
65 #endif // PRESAGE_DICTIONARYPREDICTOR
predictor.h
Observer
Definition: observer.h:34
DictionaryPredictor::PROBABILITY
std::string PROBABILITY
Definition: dictionaryPredictor.h:57
Prediction
Definition: prediction.h:47
Predictor
Definition: predictor.h:46
ContextTracker
Tracks user interaction and context.
Definition: contextTracker.h:155
DictionaryPredictor::learn
virtual void learn(const std::vector< std::string > &change)
Definition: dictionaryPredictor.cpp:102
DictionaryPredictor::DICTIONARY
std::string DICTIONARY
Definition: dictionaryPredictor.h:56
DictionaryPredictor::update
virtual void update(const Observable *variable)
Definition: dictionaryPredictor.cpp:108
DictionaryPredictor
Definition: dictionaryPredictor.h:40
DictionaryPredictor::probability
double probability
Definition: dictionaryPredictor.h:60
DictionaryPredictor::~DictionaryPredictor
~DictionaryPredictor()
Definition: dictionaryPredictor.cpp:49
DictionaryPredictor::set_dictionary
void set_dictionary(const std::string &value)
Definition: dictionaryPredictor.cpp:54
DictionaryPredictor::predict
virtual Prediction predict(const size_t size, const char **filter) const
Generate prediction.
Definition: dictionaryPredictor.cpp:67
Configuration
Definition: configuration.h:36
DictionaryPredictor::DictionaryPredictor
DictionaryPredictor(Configuration *, ContextTracker *, const char *)
Definition: dictionaryPredictor.cpp:30
Observable
Definition: observable.h:37
DictionaryPredictor::LOGGER
std::string LOGGER
Definition: dictionaryPredictor.h:55
DictionaryPredictor::dispatcher
Dispatcher< DictionaryPredictor > dispatcher
Definition: dictionaryPredictor.h:62
Dispatcher< DictionaryPredictor >
DictionaryPredictor::dictionary_path
std::string dictionary_path
Definition: dictionaryPredictor.h:59
DictionaryPredictor::set_probability
void set_probability(const std::string &value)
Definition: dictionaryPredictor.cpp:61