presage  0.9.2~beta
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Predictor Class Referenceabstract

#include <predictor.h>

Inheritance diagram for Predictor:
Inheritance graph
Collaboration diagram for Predictor:
Collaboration graph

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
 
ContextTrackercontextTracker
 
Configurationconfiguration
 
Logger< char > logger
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Predictor()

Predictor::Predictor ( Configuration config,
ContextTracker ct,
const char *  predictorName = "Predictor",
const char *  shortDesc = "",
const char *  longDesc = "" 
)

Creates a predictor object.

Parameters
configpointer to configuration
ctis a reference to HistoryTracker
predictorNameis the predictor name
shortDescis a short description of the predictor's functionality
longDescis a long description of the predictor's functionality

Definition at line 39 of file predictor.cpp.

◆ ~Predictor()

Predictor::~Predictor ( )
virtual

Virtual predictor destructor.

Definition at line 60 of file predictor.cpp.

Member Function Documentation

◆ getLongDescription()

const std::string Predictor::getLongDescription ( ) const

Get predictor long description.

Definition at line 82 of file predictor.cpp.

References longDescription.

◆ getName()

const std::string Predictor::getName ( ) const

Get predictor name.

Definition at line 66 of file predictor.cpp.

References name.

Referenced by PredictorActivator::predict().

Here is the caller graph for this function:

◆ getShortDescription()

const std::string Predictor::getShortDescription ( ) const

Get predictor short description.

Definition at line 74 of file predictor.cpp.

References shortDescription.

◆ learn()

virtual void Predictor::learn ( const std::vector< std::string > &  change)
pure virtual

◆ predict()

virtual Prediction Predictor::predict ( const size_t  size,
const char **  filter 
) const
pure virtual

Generate prediction.

Parameters
sizedesired prediction size
filterfilter

Implemented in ARPAPredictor, RecencyPredictor, SmoothedNgramPredictor, AbbreviationExpansionPredictor, DejavuPredictor, DictionaryPredictor, and DummyPredictor.

Referenced by PredictorActivator::predict().

Here is the caller graph for this function:

◆ set_logger()

void Predictor::set_logger ( const std::string &  level)
protectedvirtual

◆ token_satisfies_filter()

bool Predictor::token_satisfies_filter ( const std::string &  token,
const std::string &  prefix,
const char **  filter 
) const
protectedvirtual

Definition at line 95 of file predictor.cpp.

Referenced by DictionaryPredictor::predict(), DejavuPredictor::predict(), and RecencyPredictor::predict().

Here is the caller graph for this function:

Member Data Documentation

◆ configuration

Configuration* Predictor::configuration
protected

Definition at line 85 of file predictor.h.

◆ contextTracker

ContextTracker* Predictor::contextTracker
protected

◆ logger

Logger<char> Predictor::logger
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().

◆ longDescription

const std::string Predictor::longDescription
protected

Definition at line 79 of file predictor.h.

Referenced by getLongDescription().

◆ name

const std::string Predictor::name
protected

◆ PREDICTORS

const std::string Predictor::PREDICTORS
protected

◆ shortDescription

const std::string Predictor::shortDescription
protected

Definition at line 78 of file predictor.h.

Referenced by getShortDescription().


The documentation for this class was generated from the following files: