51int main(
int argc,
char** argv)
65 presage.
config(
"Presage.Selector.SUGGESTIONS", ss.str());
69 const int BUFFER_SIZE = 80;
70 char buffer[ BUFFER_SIZE ];
74 std::cin.getline (
buffer, BUFFER_SIZE);
80 std::cout <<
"-- Context: " << presage.
context() <<
'|' << std::endl;
82 std::cout <<
"-- Context changed" << std::endl;
93 "Presage Textual Demo\n"
94 "--------------------\n"
96 "This program is intended as a demonstration of Presage ONLY.\n"
98 "The Presage project aims to provide an intelligent predictive text entry platform.\n"
100 "Its intent is NOT to provide a predictive text entry user interface.\n"
101 "Think of Presage as the predictive backend that sits behind a shiny user interface and does all the predictive heavy lifting.\n"
110 const char*
const short_options =
"c:s:hv";
112 const struct option long_options[] = {
113 {
"config", required_argument, 0,
'c' },
114 {
"suggestions", required_argument, 0,
's' },
115 {
"help", no_argument, 0,
'h' },
116 {
"version", no_argument, 0,
'v' },
121 next_option = getopt_long( argc, argv,
122 short_options, long_options, NULL );
124 switch( next_option ) {
150 }
while (next_option != -1);
155 for( std::vector<std::string>::const_iterator i = words.begin();
158 std::cout << *i << std::endl;
164 std::cout <<
PROGRAM_NAME <<
" (" << PACKAGE <<
") version " << VERSION << std::endl
165 <<
"Copyright (C) 2004 Matteo Vescovi." << std::endl
166 <<
"This is free software; see the source for copying conditions. There is NO" << std::endl
167 <<
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE," << std::endl
168 <<
"to the extent permitted by law." << std::endl;
173 std::cout <<
"Usage: " <<
PROGRAM_NAME <<
" [OPTION]..." << std::endl
175 <<
"At the prompt, type in some text. Hit enter to generate a prediction." << std::endl
176 <<
"Any text input is valid, including no text, a single character, or a long string." << std::endl
178 <<
" -c, --config CONFIG use config file CONFIG" << std::endl
179 <<
" -s, --suggestions N set prediction size to N suggestions" << std::endl
180 <<
" -h, --help display this help and exit" << std::endl
181 <<
" -v, --version output version information and exit" << std::endl
183 <<
"Direct your bug reports to: " << PACKAGE_BUGREPORT << std::endl;
void update(std::string str)
Presage, the intelligent predictive text entry platform.
bool context_change() const EXCEPT(PresageException)
Returns true if a context change occured.
std::string context() const EXCEPT(PresageException)
Returns the text entered so far.
std::vector< std::string > predict() EXCEPT(PresageException)
Obtain a prediction.
std::string config(const std::string variable) const EXCEPT(PresageException)
Gets the value of specified configuration variable.
int main(int argc, char **argv)
void print_prediction(const std::vector< std::string > &)
const char PROGRAM_NAME[]
void parse_cmd_line_args(int argc, char **argv)