presage
0.9.2~beta
|
#include <predictor.h>
Public Member Functions | |
Predictor (Configuration *configuration, ContextTracker *contextTracker, const char *predictorName="Predictor", const char *shortDescription="", const char *longDescription="") | |
virtual | ~Predictor () |
virtual Prediction | predict (const size_t size, const char **filter) const =0 |
Generate prediction. More... | |
virtual void | learn (const std::vector< std::string > &change)=0 |
const std::string | getName () const |
const std::string | getShortDescription () const |
const std::string | getLongDescription () const |
Protected Member Functions | |
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 Attributes | |
const std::string | name |
const std::string | shortDescription |
const std::string | longDescription |
const std::string | PREDICTORS |
ContextTracker * | contextTracker |
Configuration * | configuration |
Logger< char > | logger |
Predictor is an abstract class that defines the interface implemented by concrete predictors.
The prediction algorithm implemented by predictors is at the heart of presage. The predictor-based architecture allows new prediction methods to be easily and transparently added to the system.
Predictors have access to and rely on the services provided by core components of the presage system.
Definition at line 46 of file predictor.h.
Predictor::Predictor | ( | Configuration * | config, |
ContextTracker * | ct, | ||
const char * | predictorName = "Predictor" , |
||
const char * | shortDesc = "" , |
||
const char * | longDesc = "" |
||
) |
Creates a predictor object.
config | pointer to configuration |
ct | is a reference to HistoryTracker |
predictorName | is the predictor name |
shortDesc | is a short description of the predictor's functionality |
longDesc | is a long description of the predictor's functionality |
Definition at line 39 of file predictor.cpp.
|
virtual |
Virtual predictor destructor.
Definition at line 60 of file predictor.cpp.
const std::string Predictor::getLongDescription | ( | ) | const |
Get predictor long description.
Definition at line 82 of file predictor.cpp.
References longDescription.
const std::string Predictor::getName | ( | ) | const |
Get predictor name.
Definition at line 66 of file predictor.cpp.
References name.
Referenced by PredictorActivator::predict().
const std::string Predictor::getShortDescription | ( | ) | const |
Get predictor short description.
Definition at line 74 of file predictor.cpp.
References shortDescription.
|
pure virtual |
Implemented in ARPAPredictor, RecencyPredictor, SmoothedNgramPredictor, AbbreviationExpansionPredictor, DejavuPredictor, DictionaryPredictor, and DummyPredictor.
Referenced by ContextTracker::learn().
|
pure virtual |
Generate prediction.
size | desired prediction size |
filter | filter |
Implemented in ARPAPredictor, RecencyPredictor, SmoothedNgramPredictor, AbbreviationExpansionPredictor, DejavuPredictor, DictionaryPredictor, and DummyPredictor.
Referenced by PredictorActivator::predict().
|
protectedvirtual |
Definition at line 88 of file predictor.cpp.
References endl(), logger, and setlevel().
Referenced by AbbreviationExpansionPredictor::AbbreviationExpansionPredictor(), ARPAPredictor::ARPAPredictor(), DejavuPredictor::DejavuPredictor(), DictionaryPredictor::DictionaryPredictor(), RecencyPredictor::RecencyPredictor(), and SmoothedNgramPredictor::SmoothedNgramPredictor().
|
protectedvirtual |
Definition at line 95 of file predictor.cpp.
Referenced by DictionaryPredictor::predict(), DejavuPredictor::predict(), and RecencyPredictor::predict().
|
protected |
Definition at line 85 of file predictor.h.
|
protected |
Definition at line 83 of file predictor.h.
Referenced by DejavuPredictor::init_memory_trigger(), SmoothedNgramPredictor::learn(), DictionaryPredictor::predict(), DejavuPredictor::predict(), AbbreviationExpansionPredictor::predict(), SmoothedNgramPredictor::predict(), RecencyPredictor::predict(), and ARPAPredictor::predict().
|
protected |
Definition at line 87 of file predictor.h.
Referenced by ARPAPredictor::addBigram(), ARPAPredictor::addTrigram(), ARPAPredictor::addUnigram(), AbbreviationExpansionPredictor::cacheAbbreviationsExpansions(), SmoothedNgramPredictor::check_learn_consistency(), ARPAPredictor::computeTrigramBackoff(), SmoothedNgramPredictor::count(), ARPAPredictor::createARPATable(), DejavuPredictor::init_memory_trigger(), DejavuPredictor::init_rolling_window(), DejavuPredictor::learn(), SmoothedNgramPredictor::learn(), ARPAPredictor::learn(), ARPAPredictor::loadVocabulary(), DictionaryPredictor::predict(), DejavuPredictor::predict(), AbbreviationExpansionPredictor::predict(), SmoothedNgramPredictor::predict(), RecencyPredictor::predict(), ARPAPredictor::predict(), AbbreviationExpansionPredictor::set_abbreviations(), ARPAPredictor::set_arpa_filename(), SmoothedNgramPredictor::set_count_threshold(), RecencyPredictor::set_cutoff_threshold(), SmoothedNgramPredictor::set_dbfilename(), SmoothedNgramPredictor::set_deltas(), DictionaryPredictor::set_dictionary(), RecencyPredictor::set_lambda(), SmoothedNgramPredictor::set_learn(), set_logger(), DejavuPredictor::set_memory(), RecencyPredictor::set_n_0(), DictionaryPredictor::set_probability(), ARPAPredictor::set_timeout(), DejavuPredictor::set_trigger(), ARPAPredictor::set_vocab_filename(), DictionaryPredictor::update(), DejavuPredictor::update(), AbbreviationExpansionPredictor::update(), SmoothedNgramPredictor::update(), RecencyPredictor::update(), ARPAPredictor::update(), and DejavuPredictor::update_rolling_window().
|
protected |
Definition at line 79 of file predictor.h.
Referenced by getLongDescription().
|
protected |
Definition at line 77 of file predictor.h.
Referenced by AbbreviationExpansionPredictor::AbbreviationExpansionPredictor(), ARPAPredictor::ARPAPredictor(), DejavuPredictor::DejavuPredictor(), DictionaryPredictor::DictionaryPredictor(), getName(), RecencyPredictor::RecencyPredictor(), and SmoothedNgramPredictor::SmoothedNgramPredictor().
|
protected |
Definition at line 81 of file predictor.h.
Referenced by AbbreviationExpansionPredictor::AbbreviationExpansionPredictor(), ARPAPredictor::ARPAPredictor(), DejavuPredictor::DejavuPredictor(), DictionaryPredictor::DictionaryPredictor(), RecencyPredictor::RecencyPredictor(), and SmoothedNgramPredictor::SmoothedNgramPredictor().
|
protected |
Definition at line 78 of file predictor.h.
Referenced by getShortDescription().