presage  0.9.2~beta
Public Member Functions | Private Attributes | List of all members
DictionaryPredictor Class Reference

#include <dictionaryPredictor.h>

Inheritance diagram for DictionaryPredictor:
Inheritance graph
Collaboration diagram for DictionaryPredictor:
Collaboration graph

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

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

Detailed Description

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.

Constructor & Destructor Documentation

◆ DictionaryPredictor()

DictionaryPredictor::DictionaryPredictor ( Configuration config,
ContextTracker ht,
const char *  name 
)

◆ ~DictionaryPredictor()

DictionaryPredictor::~DictionaryPredictor ( )

Definition at line 49 of file dictionaryPredictor.cpp.

Member Function Documentation

◆ learn()

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

Implements Predictor.

Definition at line 102 of file dictionaryPredictor.cpp.

References endl().

Here is the call graph for this function:

◆ predict()

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

Generate prediction.

Parameters
sizedesired prediction size
filterfilter

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

Here is the call graph for this function:

◆ set_dictionary()

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

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

◆ set_probability()

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

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

◆ update()

void DictionaryPredictor::update ( const Observable variable)
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.

Here is the call graph for this function:

Member Data Documentation

◆ DICTIONARY

std::string DictionaryPredictor::DICTIONARY
private

Definition at line 56 of file dictionaryPredictor.h.

Referenced by DictionaryPredictor().

◆ dictionary_path

std::string DictionaryPredictor::dictionary_path
private

Definition at line 59 of file dictionaryPredictor.h.

Referenced by predict(), and set_dictionary().

◆ dispatcher

Dispatcher<DictionaryPredictor> DictionaryPredictor::dispatcher
private

Definition at line 62 of file dictionaryPredictor.h.

Referenced by DictionaryPredictor(), and update().

◆ LOGGER

std::string DictionaryPredictor::LOGGER
private

Definition at line 55 of file dictionaryPredictor.h.

Referenced by DictionaryPredictor().

◆ PROBABILITY

std::string DictionaryPredictor::PROBABILITY
private

Definition at line 57 of file dictionaryPredictor.h.

Referenced by DictionaryPredictor().

◆ probability

double DictionaryPredictor::probability
private

Definition at line 60 of file dictionaryPredictor.h.

Referenced by predict(), and set_probability().


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