presage
0.9.2~beta
|
#include <dictionaryPredictor.h>
Public Member Functions | |
DictionaryPredictor (Configuration *, ContextTracker *, const char *) | |
~DictionaryPredictor () | |
virtual Prediction | predict (const size_t size, const char **filter) const |
Generate prediction. More... | |
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) |
Public Member Functions inherited from Predictor | |
Predictor (Configuration *configuration, ContextTracker *contextTracker, const char *predictorName="Predictor", const char *shortDescription="", const char *longDescription="") | |
virtual | ~Predictor () |
const std::string | getName () const |
const std::string | getShortDescription () const |
const std::string | getLongDescription () const |
Public Member Functions inherited from Observer | |
virtual | ~Observer () |
Private Attributes | |
std::string | LOGGER |
std::string | DICTIONARY |
std::string | PROBABILITY |
std::string | dictionary_path |
double | probability |
Dispatcher< DictionaryPredictor > | dispatcher |
Additional Inherited Members | |
Protected Member Functions inherited from Predictor | |
virtual bool | token_satisfies_filter (const std::string &token, const std::string &prefix, const char **filter) const |
virtual void | set_logger (const std::string &level) |
Protected Member Functions inherited from Observer | |
Observer () | |
Protected Attributes inherited from Predictor | |
const std::string | name |
const std::string | shortDescription |
const std::string | longDescription |
const std::string | PREDICTORS |
ContextTracker * | contextTracker |
Configuration * | configuration |
Logger< char > | logger |
Dictionary predictive predictor.
Generates a prediction by extracting tokens that start with the current prefix from a given dictionary.
Definition at line 40 of file dictionaryPredictor.h.
DictionaryPredictor::DictionaryPredictor | ( | Configuration * | config, |
ContextTracker * | ht, | ||
const char * | name | ||
) |
Definition at line 30 of file dictionaryPredictor.cpp.
References config, DICTIONARY, dispatcher, LOGGER, Dispatcher< class_t >::map(), Predictor::name, Predictor::PREDICTORS, PROBABILITY, set_dictionary(), Predictor::set_logger(), and set_probability().
DictionaryPredictor::~DictionaryPredictor | ( | ) |
Definition at line 49 of file dictionaryPredictor.cpp.
|
virtual |
Implements Predictor.
Definition at line 102 of file dictionaryPredictor.cpp.
References endl().
|
virtual |
Generate prediction.
size | desired prediction size |
filter | filter |
Implements Predictor.
Definition at line 67 of file dictionaryPredictor.cpp.
References Prediction::addSuggestion(), Predictor::contextTracker, dictionary_path, endl(), ContextTracker::getPrefix(), Predictor::logger, probability, and Predictor::token_satisfies_filter().
void DictionaryPredictor::set_dictionary | ( | const std::string & | value | ) |
Definition at line 54 of file dictionaryPredictor.cpp.
References dictionary_path, endl(), and Predictor::logger.
Referenced by DictionaryPredictor().
void DictionaryPredictor::set_probability | ( | const std::string & | value | ) |
Definition at line 61 of file dictionaryPredictor.cpp.
References endl(), Predictor::logger, probability, and Utility::toDouble().
Referenced by DictionaryPredictor().
|
virtual |
Implements Observer.
Definition at line 108 of file dictionaryPredictor.cpp.
References Dispatcher< class_t >::dispatch(), dispatcher, endl(), Observable::get_name(), Observable::get_value(), and Predictor::logger.
|
private |
Definition at line 56 of file dictionaryPredictor.h.
Referenced by DictionaryPredictor().
|
private |
Definition at line 59 of file dictionaryPredictor.h.
Referenced by predict(), and set_dictionary().
|
private |
Definition at line 62 of file dictionaryPredictor.h.
Referenced by DictionaryPredictor(), and update().
|
private |
Definition at line 55 of file dictionaryPredictor.h.
Referenced by DictionaryPredictor().
|
private |
Definition at line 57 of file dictionaryPredictor.h.
Referenced by DictionaryPredictor().
|
private |
Definition at line 60 of file dictionaryPredictor.h.
Referenced by predict(), and set_probability().