Warning: session_start(): open(/var/lib/php/sessions/sess_u4r1ilc538jipf0gffgf2rkje3, 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 IWantYouToBePrelude > DynPrintLog {
// the spaces
sS objectiveSpace = 'objective, computerSpace = 'computery, userSpace = 'usery;
// the names
transient S userName = "usery", computerName = "computery";
// the facts
transient Set facts = litciset(
"Computery is usery's assistant",
"It is impossible that {Computery is usery's mother}");
// the rules
transient WordTokRule rule_iWantYouToBe = wordTokReplacerRule(
"I want you to be my assistant", "assistant", "I want that {you are my assistant}");
transient WordTokRule rule_useryWants = new WordTokRule("Usery wants that X", "X") {
run {
S x_simplified = simpleSpaces_nTok(getVar("X"));
if (contains(facts, x_simplified))
emit("But " + x_simplified + " already");
else if (contains(facts, "It is impossible that " + curly(x_simplified) + "}"))
emit("No way brother");
}
};
// rules by space
transient MultiMap rulesForSpace = litmultimap(
userSpace, ll(rule_iWantYouToBe),
objectiveSpace, ll(rule_useryWants)
);
Collection applyRules(L rules, S s) {
ret concatListsToCISet(map(rules, rule ->
rule.matches(s) ? getStringEmits(rule) : null
);
}
Set rewriteInSpace(S space, S input) {
ret rewriteInSpace(space, ll(input));
}
Set rewriteInSpace(S space, Collection inputs) {
Set out = cloneLinkedCISet(inputs);
L rules = rulesForSpace.get(space);
for unnull (S input : inputs)
functionReturningList_transitiveHull_ciSet(func(S s) -> Collection { applyRules(rules, s) }, input, seen := out);
ret out;
}
S spaceToSpace(S space1, S space2, S input) {
if (eq(space1, userSpace) && eq(space2, objectiveSpace))
ret switcheroo_youToName(computerName, switcheroo_iToName(userName, input));
if (eq(space1, objectiveSpace) && eq(space2, computerSpace))
ret switcheroo_nameToYou(userName, switcheroo_nameToI(computerName, input));
ret input;
}
start-thread {
S input = "I want you to be my mother";
// first, rewrite in user space
Set outputs = rewriteInSpace(userSpace, input);
pnl(outputs);
// translate to objective space
LS outputs2 = map(s -> spaceToSpace(userSpace, objectiveSpace, s), outputs);
pnl(outputs2);
// rewrite in objective space
Set outputs3 = rewriteInSpace(objectiveSpace, outputs2);
pnl(outputs3);
printDone();
}
}