Predictor Class Referenceabstract

`#include <predictor.h>`

Inheritance diagram for Predictor:
Collaboration diagram for Predictor:

## 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

## 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

  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.

## ~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

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

Referenced by ContextTracker::learn().

Here is the caller graph for this function:

## predict()

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

pure virtual

Generate prediction.

Parameters

  size | desired prediction size
  filter | filter

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 | ) |

protected virtual

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().

Here is the call graph for this function:
Here is the caller graph for this function:

## token_satisfies_filter()

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

protected virtual

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

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().

## 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(), 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

Definition at line 77 of file predictor.h.

Referenced by getName().

## PREDICTORS

const std::string Predictor::PREDICTORS

protected

Definition at line 81 of file predictor.h.

Referenced by AbbreviationExpansionPredictor::AbbreviationExpansionPredictor(), ARPAPredictor::ARPAPredictor(), DejavuPredictor::DejavuPredictor(), DictionaryPredictor::DictionaryPredictor(), RecencyPredictor::RecencyPredictor(), and SmoothedNgramPredictor::SmoothedNgramPredictor().

## 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:

- /build/presage-1beMKb/presage-0.9.1/src/lib/predictors/predictor.h
- /build/presage-1beMKb/presage-0.9.1/src/lib/predictors/predictor.cpp