!7 module SpeechRecogConfirmation > DynPrintLogAndButtons { start { onSpeechRecognized_withoutMyUtterancesAndTyped(voidfunc(fS s) { print("\nI heard: " + quote(s)); if (eq(s, "?")) { fS q = "Did you say anything?"; print(q); showButtons( "Yes", r { log(s, q, 'yes); whatDidYouSay(s); }, "No", r { log(s, q, 'no); print("Thanks"); }); } else { fS q = "Did you say that?"; print(q); showButtons( "Yes", r { log(s, q, 'yes); print("Thanks"); }, "No", r { log(s, q, 'no); whatDidYouSay(s); }); } }); } void log(S heard, S question, S answer) { print("> " + upper(answer)); logStructure(programLogFile(), litorderedmap(+heard, +question, +answer)); hideButtons(); } void whatDidYouSay(fS heard) { print("What did you say?"); final JTextField tf = jTextField(heard); showButtons(textFieldAndButton(tf, "is what I said", voidfunc(S corrected) { print("> I said " + quote(upper(corrected))); logStructure(programLogFile(), litorderedmap(+heard, +corrected)); hideButtons(); print("Thanks"); })); focus(tf); } }