Warning: session_start(): open(/var/lib/php/sessions/sess_g22o29pbvhclv7nn7985m7euu0, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
cmodule IsBot > DynAttractorBot {
PairS splitIt(S s) {
LS tok = wordTok(s);
int i = -1;
if (l(tok) == 2*2+1) // two words
i = 3;
else {
L determiners = indicesOfAny(tok, mechCISet("Determiners"));
if (isBetween(l(determiners), 1, 2))
i = last(determiners);
}
ret i < 0 ? null : pair(joinSubList(tok, 1, i-1), joinSubList(tok, i, l(tok)-1));
}
AttractorBot makeBot() {
ret testBot(attractorBotFromLambda(input -> {
input = ai_userSpaceToObjective(input);
print("Got objective space input: " + input);
LS tok = wordTok(input);
S linkWord = second(tok);
ret unless eqicOneOf(linkWord, "is", "are", "am");
// tautological case
S s = joinSubList(tok, 3);
if (matchDoubleRest("", s))
ret with emitAnswer(print("Emitting", "yes, obviously"));
PairS p = splitIt(s);
if (p == null) ret with emitAnswer("I can't parse that sentence");
S a = p.a, b = p.b;
emitAnswer(ai_objectiveSpaceToBot("I don't know if " + a + " " + linkWord + " " + b));
}));
}
AttractorBot testBot(AttractorBot bot) {
testAttractorBotResponses_noFail(bot,
"is green green?", "yes, obviously",
"is a man a child?", "I wonder if a man is a child",
"is sleep pleasant", "I wonder if sleep is pleasant");
ret bot;
}
}