presage
0.9.2~beta
|
#include <abbreviationExpansionPredictor.h>
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 |
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.
AbbreviationExpansionPredictor::AbbreviationExpansionPredictor | ( | Configuration * | config, |
ContextTracker * | ct, | ||
const char * | name | ||
) |
Definition at line 30 of file abbreviationExpansionPredictor.cpp.
References ABBREVIATIONS, config, dispatcher, LOGGER, Dispatcher< class_t >::map(), Predictor::name, Predictor::PREDICTORS, set_abbreviations(), and Predictor::set_logger().
AbbreviationExpansionPredictor::~AbbreviationExpansionPredictor | ( | ) |
Definition at line 47 of file abbreviationExpansionPredictor.cpp.
|
private |
Definition at line 92 of file abbreviationExpansionPredictor.cpp.
References abbreviations, buffer, cache, endl(), and Predictor::logger.
Referenced by set_abbreviations().
|
virtual |
Implements Predictor.
Definition at line 87 of file abbreviationExpansionPredictor.cpp.
|
virtual |
Generate prediction.
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.
|
private |
Definition at line 53 of file abbreviationExpansionPredictor.cpp.
References abbreviations, cacheAbbreviationsExpansions(), endl(), and Predictor::logger.
Referenced by AbbreviationExpansionPredictor().
|
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.
|
private |
Definition at line 58 of file abbreviationExpansionPredictor.h.
Referenced by AbbreviationExpansionPredictor().
|
private |
Definition at line 63 of file abbreviationExpansionPredictor.h.
Referenced by cacheAbbreviationsExpansions(), and set_abbreviations().
|
private |
Definition at line 64 of file abbreviationExpansionPredictor.h.
Referenced by cacheAbbreviationsExpansions(), and predict().
|
private |
Definition at line 66 of file abbreviationExpansionPredictor.h.
Referenced by AbbreviationExpansionPredictor(), and update().
|
private |
Definition at line 57 of file abbreviationExpansionPredictor.h.
Referenced by AbbreviationExpansionPredictor().