AbbreviationExpansionPredictor Class Reference

`#include <abbreviationExpansionPredictor.h>`

Inheritance diagram for AbbreviationExpansionPredictor:
Collaboration diagram for AbbreviationExpansionPredictor:

## Public Member Functions

| AbbreviationExpansionPredictor (Configuration *, ContextTracker *, const char *)
| ~AbbreviationExpansionPredictor ()
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)
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 Member Functions

void | set_abbreviations (const std::string &filename)
void | cacheAbbreviationsExpansions ()

## Private Attributes

std::string | LOGGER
std::string | ABBREVIATIONS
std::string | abbreviations
std::map< std::string, std::string > | cache
Dispatcher < AbbreviationExpansionPredictor > | 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

## Detailed Description

Abbreviation expansion predictor.

This predictor maps abbreviations to the corresponding fully expanded token (i.e. word or phrase).

The mapping between abbreviations and expansions is stored in the file specified by the predictor configuration section.

The format for the abbreviation-expansion database is a simple tab separated text file format, with each abbreviation-expansion pair per line.

Definition at line 45 of file abbreviationExpansionPredictor.h.

## Constructor & Destructor Documentation

AbbreviationExpansionPredictor::AbbreviationExpansionPredictor | ( | Configuration * | config,
|  | ContextTracker * | ct,
|  | const char * | name
| ) |  |

Definition at line 30 of file abbreviationExpansionPredictor.cpp.

References ABBREVIATIONS, dispatcher, Configuration::find(), LOGGER, Dispatcher< class_t >::map(), Predictor::PREDICTORS, set_abbreviations(), and Predictor::set_logger().

Here is the call graph for this function:

AbbreviationExpansionPredictor::~AbbreviationExpansionPredictor | ( |  | ) |

Definition at line 47 of file abbreviationExpansionPredictor.cpp.

## Member Function Documentation

void AbbreviationExpansionPredictor::cacheAbbreviationsExpansions | ( |  | ) |

private

Definition at line 92 of file abbreviationExpansionPredictor.cpp.

References abbreviations, buffer, cache, endl(), and Predictor::logger.

Referenced by set_abbreviations().

Here is the call graph for this function:

Here is the caller graph for this function:

void AbbreviationExpansionPredictor::learn | ( | const std::vector< std::string > & | change | ) |

virtual

Implements Predictor.

Definition at line 87 of file abbreviationExpansionPredictor.cpp.

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

virtual

Generate prediction.

Parameters

  size | desired prediction size
  filter | filter

Implements Predictor.

Definition at line 62 of file abbreviationExpansionPredictor.cpp.

References Prediction::addSuggestion(), cache, Predictor::contextTracker, endl(), ContextTracker::getPrefix(), and Predictor::logger.

Here is the call graph for this function:

void AbbreviationExpansionPredictor::set_abbreviations | ( | const std::string & | filename | ) |

private

Definition at line 53 of file abbreviationExpansionPredictor.cpp.

References abbreviations, cacheAbbreviationsExpansions(), endl(), and Predictor::logger.

Referenced by AbbreviationExpansionPredictor().

Here is the call graph for this function:

Here is the caller graph for this function:

void AbbreviationExpansionPredictor::update | ( | const Observable * | variable | ) |

virtual

Implements Observer.

Definition at line 126 of file abbreviationExpansionPredictor.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

std::string AbbreviationExpansionPredictor::ABBREVIATIONS

private

Definition at line 58 of file abbreviationExpansionPredictor.h.

Referenced by AbbreviationExpansionPredictor().

std::string AbbreviationExpansionPredictor::abbreviations

private

Definition at line 63 of file abbreviationExpansionPredictor.h.

Referenced by cacheAbbreviationsExpansions(), and set_abbreviations().

std::map< std::string, std::string> AbbreviationExpansionPredictor::cache

private

Definition at line 64 of file abbreviationExpansionPredictor.h.

Referenced by cacheAbbreviationsExpansions(), and predict().

Dispatcher<AbbreviationExpansionPredictor> AbbreviationExpansionPredictor::dispatcher

private

Definition at line 66 of file abbreviationExpansionPredictor.h.

Referenced by AbbreviationExpansionPredictor(), and update().

std::string AbbreviationExpansionPredictor::LOGGER

private

Definition at line 57 of file abbreviationExpansionPredictor.h.

Referenced by AbbreviationExpansionPredictor().

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

- /build/buildd/presage-0.8.8/src/lib/predictors/abbreviationExpansionPredictor.h
- /build/buildd/presage-0.8.8/src/lib/predictors/abbreviationExpansionPredictor.cpp