!7 static new L thoughtBots; // allows skipping patterns when they don't apply concept Learner { S pattern; SS examples = mapInConcept(this, litorderedmap()); // maps to 'assumed, 'confirmed or 'rejected } p { db(); autoRestart(); serveHttp(4678); typicalDownload(); bot("Smart Bot."); loadPage_forcedTimeout = 70000; loadBots(#1010753, #1010821, #1010825); thoughtBots.add(mc()); stefansChat_onLine_lookback = 2; stefansChat_onLine_safe(voidfunc(S text) { print("> " + text); S answer = scanMultipleBots(thoughtBots, text); if (nempty(answer)) postToStefansChat(answer); }); stefansChat_post("Smart Bot Online!"); runInNewThread(#1010793); // Post on UAIP } answer { s = trim(s); if (eqic(s, "!restart")) { restart(); ret "Yo"; } if "Are you online?" ret "Yes"; if (eqic(s, "!question")) ret random_gac36k(); if "give me subtypes of ..." ret ai_renderList(ai_subtypesOf(m.rest())); if "show me the ..." ret "What " + $1 + "?"; if (flexMatch("What do * have?", s, m)) ret ai_renderNodesList(webs_search_dollarX(webFromTriples($1, "have", "$X"), indexedWebs($1))); if "What is ..." ret ai_renderNodesList(webs_search_dollarX(webFromTriples($1, "is", "$X"), indexedWebs($1)), "I don't know"); S match; if (learnedFlexMatch(match = "* is *", s, m)) { postSoftwareMadeWeb(webFromTriples($1, "is", $3), +match, input := s); ret "OK, stored."; } } svoid loadBots(S... botIDs) { for (S id : botIDs) pcall { thoughtBots.add(runSubBot(id)); } } sbool learnedFlexMatch(S pattern, S s, Matches m) { if (!flexMatch(pattern, s, m)) false; Learner l = uniq(Learner, +pattern); S status = l.examples.get(s); if (eq(status, 'rejected)) false; if (empty(status)) l.examples.put(status, 'assumed); true; } html { ret serveText(printLog()); }