static S voice = "Alex"; static new ThreadLocal pivoMode; static L matches = litlist( "Was machen wir heute?", "Frau Petersen besuchen!", "hallo du ey hey hi assistent sag doch mal mir na ja so yo denn eigentlich und noch alles überhaupt schönes", "Was wollen wir da?", "Viel Geld beantragen", "und dann denn", "Ich soll dich demonstrieren", "Na denn man los!", "", "Kannst du rechnen?", "Na klar!", "auch", "" ); static void pivoLoad() { load("voice"); } static S setVoice(S v) { voice = v; save("voice"); ret "Hallo, hier ist " + v; } static synchronized S answer(S s) { new Matches m; if (!attn()) ret null; if (!eq(getUserName (), "stefanreich") && !pivoMode. get ()) ret null; if "Alex" ret setVoice("Alex"); if (match("Leo", s) || match("Leopold", s)) ret setVoice("Leopold"); if "Gudrun" ret setVoice("Gudrun"); /*if (matchQuestion_dropping("Was machen wir heute?", "hallo du ey hey hi assistent sag doch mal mir na ja so yo denn eigentlich und noch alles überhaupt schönes", s)) ret whatWeDoToday;*/ for (int i = 0; i+2 < l(matches); i += 3) { S pat = matches.get(i); S words = matches.get(i+2); if (matchQuestion_dropping(pat, words, s)) ret matches.get(i+1); } L tok = codeTokensOnly(javaTok(s)); if (l(tok) == 3 && eq(get(tok, 1), "+") && isInteger(get(tok, 0)) && isInteger(get(tok, 2))) ret str(bigint(get(tok, 0)).add(bigint(get(tok, 2)))); ret s; } static boolean matchQuestion_dropping(S pat, S wordsToDrop, S s) { ret match(pat, dropWords(s, wordsToDrop)); }