presage
0.9.2~beta
|
#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 52 of file simulator.h.
Simulator::Simulator | ( | PresageCallback * | callback, |
std::stringstream & | sstream, | ||
const std::string | config = "" |
||
) |
Definition at line 29 of file simulator.cpp.
References autoSpace, config, ki, kn, ks, presagePtr, and silent_mode.
Simulator::~Simulator | ( | ) |
Definition at line 46 of file simulator.cpp.
References presagePtr.
|
private |
Definition at line 216 of file simulator.cpp.
References endl(), Presage::prefix(), presagePtr, and silent_mode.
Referenced by simulate().
bool Simulator::getAutoSpace | ( | ) | const |
Definition at line 236 of file simulator.cpp.
References autoSpace.
int Simulator::getKi | ( | ) | const |
Definition at line 185 of file simulator.cpp.
References ki.
int Simulator::getKn | ( | ) | const |
Definition at line 197 of file simulator.cpp.
References kn.
int Simulator::getKs | ( | ) | const |
Definition at line 191 of file simulator.cpp.
References ks.
double Simulator::getKSR | ( | ) | const |
void Simulator::results | ( | ) | const |
void Simulator::setAutoSpace | ( | bool | b | ) |
Definition at line 241 of file simulator.cpp.
References autoSpace.
void Simulator::setKs | ( | int | value | ) |
Definition at line 209 of file simulator.cpp.
References ks.
void Simulator::silentMode | ( | bool | mode | ) |
Definition at line 246 of file simulator.cpp.
References silent_mode.
Referenced by main().
void Simulator::simulate | ( | std::string | str | ) |
Definition at line 52 of file simulator.cpp.
References autoSpace, find(), ki, kn, ks, m_sstream, Presage::predict(), and presagePtr.
Referenced by main().
|
private |
Definition at line 79 of file simulator.h.
Referenced by getAutoSpace(), setAutoSpace(), simulate(), and Simulator().
|
private |
Definition at line 81 of file simulator.h.
Referenced by getKi(), getKSR(), results(), simulate(), and Simulator().
|
private |
Definition at line 83 of file simulator.h.
Referenced by getKn(), getKSR(), results(), simulate(), and Simulator().
|
private |
Definition at line 82 of file simulator.h.
Referenced by getKs(), getKSR(), results(), setKs(), simulate(), and Simulator().
|
private |
Definition at line 87 of file simulator.h.
Referenced by simulate().
|
private |
Definition at line 75 of file simulator.h.
Referenced by find(), simulate(), Simulator(), and ~Simulator().
|
private |
Definition at line 85 of file simulator.h.
Referenced by find(), silentMode(), and Simulator().