presage
0.9.1
|
#include <simulator.h>
Public Member Functions | |
Simulator (PresageCallback *callback, std::stringstream &sstream, const std::string="") | |
~Simulator () | |
void | simulate (std::string) |
void | results () const |
int | getKi () const |
int | getKs () const |
int | getKn () const |
double | getKSR () const |
bool | getAutoSpace () const |
void | setAutoSpace (bool) |
void | setKs (int) |
void | silentMode (bool) |
Private Member Functions | |
bool | find (const std::vector< std::string > &, const std::string &) const |
Private Attributes | |
Presage * | presagePtr |
bool | autoSpace |
int | ki |
int | ks |
int | kn |
bool | silent_mode |
std::stringstream & | m_sstream |
Evaluates how good Presage is at doing its job (in other words, its ability to reduce keystrokes the user is required to type).
Simulator computes the KSR (Keystrokes Savings Rate) obtained by using Presage preditive ability compared to manually entering text.
The KSR is computed as ( 1 - ( ki + ks ) / kn ) * 100, where ki is the number of input characters actually typed ks is the number of keystrokes needed to select among the predictions presented kn is the number of keystrokes that would be needed if the whole text was typed without any prediction aid.
The simulator is built with a reference to a Presage object which simulates and takes a string holding the text to be run through the simulation. Multiple calls to the simulate method can take place. Each call runs the string through the simulator. The results of each simulate call update the internal state of the simulator object. The results of the simulation can be retrieved at any time by invoking the results method or the get methods.
Definition at line 51 of file simulator.h.
Simulator::Simulator | ( | PresageCallback * | callback, |
std::stringstream & | sstream, | ||
const std::string | config = "" |
||
) |
Definition at line 28 of file simulator.cpp.
References autoSpace, config, ki, kn, ks, presagePtr, and silent_mode.
Simulator::~Simulator | ( | ) |
Definition at line 45 of file simulator.cpp.
References presagePtr.
|
private |
Definition at line 215 of file simulator.cpp.
References endl(), Presage::prefix(), presagePtr, and silent_mode.
Referenced by simulate().
bool Simulator::getAutoSpace | ( | ) | const |
Definition at line 235 of file simulator.cpp.
References autoSpace.
int Simulator::getKi | ( | ) | const |
Definition at line 184 of file simulator.cpp.
References ki.
int Simulator::getKn | ( | ) | const |
Definition at line 196 of file simulator.cpp.
References kn.
int Simulator::getKs | ( | ) | const |
Definition at line 190 of file simulator.cpp.
References ks.
double Simulator::getKSR | ( | ) | const |
void Simulator::results | ( | ) | const |
void Simulator::setAutoSpace | ( | bool | b | ) |
Definition at line 240 of file simulator.cpp.
References autoSpace.
void Simulator::setKs | ( | int | value | ) |
Definition at line 208 of file simulator.cpp.
References ks.
void Simulator::silentMode | ( | bool | mode | ) |
Definition at line 245 of file simulator.cpp.
References silent_mode.
Referenced by main().
void Simulator::simulate | ( | std::string | str | ) |
Definition at line 51 of file simulator.cpp.
References autoSpace, find(), ki, kn, ks, m_sstream, Presage::predict(), and presagePtr.
Referenced by main().
|
private |
Definition at line 97 of file simulator.h.
Referenced by getAutoSpace(), setAutoSpace(), simulate(), and Simulator().
|
private |
Definition at line 99 of file simulator.h.
Referenced by getKi(), getKSR(), results(), simulate(), and Simulator().
|
private |
Definition at line 101 of file simulator.h.
Referenced by getKn(), getKSR(), results(), simulate(), and Simulator().
|
private |
Definition at line 100 of file simulator.h.
Referenced by getKs(), getKSR(), results(), setKs(), simulate(), and Simulator().
|
private |
Definition at line 105 of file simulator.h.
Referenced by simulate().
|
private |
Definition at line 93 of file simulator.h.
Referenced by find(), simulate(), Simulator(), and ~Simulator().
|
private |
Definition at line 103 of file simulator.h.
Referenced by find(), silentMode(), and Simulator().