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

#include <abbreviationExpansionPredictor.h>

Inheritance diagram for AbbreviationExpansionPredictor:
Inheritance graph
Collaboration diagram for AbbreviationExpansionPredictor:
Collaboration graph

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

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

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::AbbreviationExpansionPredictor ( Configuration config,
ContextTracker ct,
const char *  name 
)

◆ ~AbbreviationExpansionPredictor()

AbbreviationExpansionPredictor::~AbbreviationExpansionPredictor ( )

Definition at line 47 of file abbreviationExpansionPredictor.cpp.

Member Function Documentation

◆ cacheAbbreviationsExpansions()

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:

◆ learn()

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

Implements Predictor.

Definition at line 87 of file abbreviationExpansionPredictor.cpp.

◆ predict()

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

Generate prediction.

Parameters
sizedesired prediction size
filterfilter

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:

◆ set_abbreviations()

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:

◆ update()

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

◆ ABBREVIATIONS

std::string AbbreviationExpansionPredictor::ABBREVIATIONS
private

Definition at line 58 of file abbreviationExpansionPredictor.h.

Referenced by AbbreviationExpansionPredictor().

◆ abbreviations

std::string AbbreviationExpansionPredictor::abbreviations
private

◆ cache

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

Definition at line 64 of file abbreviationExpansionPredictor.h.

Referenced by cacheAbbreviationsExpansions(), and predict().

◆ dispatcher

Dispatcher<AbbreviationExpansionPredictor> AbbreviationExpansionPredictor::dispatcher
private

Definition at line 66 of file abbreviationExpansionPredictor.h.

Referenced by AbbreviationExpansionPredictor(), and update().

◆ LOGGER

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: