!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(y)) { y = "no"; say("OK, stored"); } else y = "(?) " + y; saveIsQuestion(x, y); } } } bool probablyAQuestion(S s) { ret false; } bool probablyNotAQuestion(S s) { ret false; } void saveIsQuestion(S text, S isQuestion) { dm_requireAndCallModule("#1020788/IsQuestionExamples", 'addEntry, text, isQuestion); } void sayNothing() {} S input() { ret dm_waitForTopInput(); } void say(S s) { dm_say(s); } }