dictionaryPredictor.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_DICTIONARYPREDICTOR
#define PRESAGE_DICTIONARYPREDICTOR
#include "predictor.h"
#include "../core/dispatcher.h"
#include <fstream>
class DictionaryPredictor : public Predictor, public Observer {
public:
DictionaryPredictor (Configuration*, ContextTracker*, const char*);
~DictionaryPredictor();
virtual Prediction predict (const size_t size, const char** filter) const;
virtual void learn (const std::vector<std::string>& change);
virtual void update (const Observable* variable);
void set_dictionary (const std::string& value);
void set_probability (const std::string& value);
private:
std::string LOGGER;
std::string DICTIONARY;
std::string PROBABILITY;
std::string dictionary_path;
double probability;
Dispatcher<DictionaryPredictor> dispatcher;
};
#endif // PRESAGE_DICTIONARYPREDICTOR
Configuration
Definition configuration.h:36
ContextTracker
Tracks user interaction and context.
Definition contextTracker.h:155
DictionaryPredictor::DICTIONARY
std::string DICTIONARY
Definition dictionaryPredictor.h:56
DictionaryPredictor::LOGGER
std::string LOGGER
Definition dictionaryPredictor.h:55
DictionaryPredictor::PROBABILITY
std::string PROBABILITY
Definition dictionaryPredictor.h:57
DictionaryPredictor::set_dictionary
void set_dictionary(const std::string &value)
Definition dictionaryPredictor.cpp:54
DictionaryPredictor::probability
double probability
Definition dictionaryPredictor.h:60
DictionaryPredictor::DictionaryPredictor
DictionaryPredictor(Configuration *, ContextTracker *, const char *)
Definition dictionaryPredictor.cpp:30
DictionaryPredictor::~DictionaryPredictor
~DictionaryPredictor()
Definition dictionaryPredictor.cpp:49
DictionaryPredictor::update
virtual void update(const Observable *variable)
Definition dictionaryPredictor.cpp:108
DictionaryPredictor::set_probability
void set_probability(const std::string &value)
Definition dictionaryPredictor.cpp:61
DictionaryPredictor::dictionary_path
std::string dictionary_path
Definition dictionaryPredictor.h:59
DictionaryPredictor::predict
virtual Prediction predict(const size_t size, const char **filter) const
Generate prediction.
Definition dictionaryPredictor.cpp:67
DictionaryPredictor::learn
virtual void learn(const std::vector< std::string > &change)
Definition dictionaryPredictor.cpp:102
DictionaryPredictor::dispatcher
Dispatcher< DictionaryPredictor > dispatcher
Definition dictionaryPredictor.h:62
Dispatcher
Definition dispatcher.h:42
Observable
Definition observable.h:37
Observer::Observer
Observer()
Definition observer.h:40
Prediction
Definition prediction.h:47
Predictor::Predictor
Predictor(Configuration *configuration, ContextTracker *contextTracker, const char *predictorName="Predictor", const char *shortDescription="", const char *longDescription="")
Definition predictor.cpp:39
dispatcher.h
predictor.h