!7 module QuestionDetectionTrainer > DynPrintLogAndEnabled { start { thread { mainLoop(); } } void mainLoop enter { while true { S x = input(); if (!enabled) continue; if (probablyAQuestion(x)) say("I don't know"); else if (probablyNotAQuestion(x)) { sayNothing(); thread { S y = input(); if (match("That was a question", y)) { saveIsQuestion(y, "yes"); say("Oh, sorry. Stored."); } } } else { say("Is that a question?"); S y = input(); if (isYes(y)) { y = "yes"; say("OK, stored"); } else if (isNo(input)) { y = "no"; say("OK, stored"); } else y = "(?) " + y; saveIsQuestion(x, y); } } } bool probablyAQuestion() { ret false; } bool probablyNotAQuestion() { ret false; } void saveIsQuestion(S text, S isQuestion) {} S input() { ret dm_waitForTopInput(); } void say(S s) { dm_say(s); } }