presage
0.8.7
|
#include <abbreviationExpansionPredictor.h>
Public Member Functions | |
AbbreviationExpansionPredictor (Configuration *, ContextTracker *) | |
~AbbreviationExpansionPredictor () | |
virtual Prediction | predict (const size_t size, const char **filter) const |
Generate prediction. | |
virtual void | learn (const std::vector< std::string > &change) |
virtual void | update (const Observable *variable) |
Private Member Functions | |
void | set_abbreviations (const std::string &filename) |
void | cacheAbbreviationsExpansions () |
Private Attributes | |
std::string | abbreviations |
std::map< std::string, std::string > | cache |
Dispatcher < AbbreviationExpansionPredictor > | dispatcher |
Static Private Attributes | |
static const char * | LOGGER = "Presage.Predictors.AbbreviationExpansionPredictor.LOGGER" |
static const char * | ABBREVIATIONS = "Presage.Predictors.AbbreviationExpansionPredictor.ABBREVIATIONS" |
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 | ||
) |
Definition at line 33 of file abbreviationExpansionPredictor.cpp.
References ABBREVIATIONS, dispatcher, Configuration::find(), LOGGER, Dispatcher< class_t >::map(), set_abbreviations(), and Predictor::set_logger().
Definition at line 47 of file abbreviationExpansionPredictor.cpp.
void AbbreviationExpansionPredictor::cacheAbbreviationsExpansions | ( | ) | [private] |
Definition at line 91 of file abbreviationExpansionPredictor.cpp.
References abbreviations, buffer, cache, endl(), and Predictor::logger.
Referenced by set_abbreviations().
void AbbreviationExpansionPredictor::learn | ( | const std::vector< std::string > & | change | ) | [virtual] |
Implements Predictor.
Definition at line 88 of file abbreviationExpansionPredictor.cpp.
Prediction AbbreviationExpansionPredictor::predict | ( | const size_t | size, |
const char ** | filter | ||
) | const [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.
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().
void AbbreviationExpansionPredictor::update | ( | const Observable * | variable | ) | [virtual] |
Implements Observer.
Definition at line 125 of file abbreviationExpansionPredictor.cpp.
References Dispatcher< class_t >::dispatch(), dispatcher, endl(), Observable::get_name(), Observable::get_value(), and Predictor::logger.
const char * AbbreviationExpansionPredictor::ABBREVIATIONS = "Presage.Predictors.AbbreviationExpansionPredictor.ABBREVIATIONS" [static, 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().
Definition at line 66 of file abbreviationExpansionPredictor.h.
Referenced by AbbreviationExpansionPredictor(), and update().
const char * AbbreviationExpansionPredictor::LOGGER = "Presage.Predictors.AbbreviationExpansionPredictor.LOGGER" [static, private] |
Definition at line 57 of file abbreviationExpansionPredictor.h.
Referenced by AbbreviationExpansionPredictor().