Re: how to write an interactive crm program?
Paolo <[email protected]>
| Newsgroups | gmane.mail.spam.crm114 |
|---|---|
| Message-ID | <20090131232525.GB14726@localhost> |
On Sat, Jan 31, 2009 at 10:52:50PM +0100, Thomas Michael Hagen wrote:
...
this is where my problem comes in: i'm trying to make the process
interactive, so that i can tell the program whether it classified each
...
> :interact: {
> {
> isolate (:user-feedback:)
> syscall () (:user-feedback:) /crm interact.crm/
> match (:incorrect:) [:user-feedback:] /w/ # 'w' for wrong
> output /The piece was NOT classified correctly; you input
> ':*:incorrect:'\n/
> # here is where the DSTTTR stuff will eventually go
> return
> }
simple eg - drop SYSCALL, use INPUT and read from tty
:interact: {
{
isolate (:user-feedback:)
isolate (:answer:) /r(ight)/
output /your bet, pleaz: /
input <byline> [/dev/tty] (:user-feedback:)
{
match <nocase> (:answer:) [:user-feedback:] /w.*/
}
output /You said ':*:answer:', and I trust you.\n/
# here is where the DSTTTR stuff will eventually go
return
}
proof:
$ crm '-{
window; isolate (:user-feedback:); isolate (:answer:) /r(ight)/
output /your bet, pleaz: /; input <byline> [/dev/tty] (:user-feedback:)
{ match <nocase> (:answer:) [:user-feedback:] /w.*/ }
output /You said ":*:answer:", and I trust you.\n/
}'
your bet, pleaz: w<press-return>
You said "w", and I trust you.
your bet, pleaz: <press-return>
You said "r(ight)", and I trust you.
HTH
--
paolo
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword