Warning: session_start(): open(/var/lib/php/sessions/sess_dpfjovepjj3q7g17o26raevdfu, 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
svoid applyNLLogicFacts_v2(S input, VF1 super S> postMessage) {
applyNLLogicFacts_v2(input, postMessage, mL("Random facts"));
}
svoid applyNLLogicFacts_v2(S input, VF1 super S> postMessage, LS facts) {
applyNLLogicFacts_v2(input, postMessage, facts, mapPairB_pcall(f nlLogic_parseRule, (L) combineWithGlobalIDs(splitAtEmptyLines(mL_raw("NL Logic Examples")))));
}
svoid applyNLLogicFacts_v2(S input, VF1 super S> postMessage, LS facts, L> rules) {
new NLLogicChecker_v2 c;
c.matcher = new NLStringMatcher_dollarVars;
addAll(c.facts, facts);
c.input = input;
applyNLLogicFacts_v2(c, postMessage, rules);
}
svoid applyNLLogicFacts_v2(NLLogicChecker_v2 c, VF1 super S> postMessage, L> rules) {
for (Pair idAndRule : rules) pcall {
IfThen rule = idAndRule.b;
new NLLogicChecker_v2.Matching m;
if (c.checkRule(rule, m)) {
print("Matched " + quote(input) + " with rule " + quote(rule));
printStruct(m.matches);
new SS matches; // matches made in evaluating RHS of rule
for (Exp out : m.output)
for (Exp e : nlLogic_unrollAnd(out))
if (e cast Func) {
if (eq(e.name, "output") && e.arg instanceof Sentence)
callF(postMessage, replaceVars(nlLogic_text(e.arg), matches));
} else if (e cast Eq) {
Exp r = e.right;
S var = nlLogic_text(e.left);
if (r cast Func)
if (isStandardFunction(r.name) && r.arg instanceof Sentence && noJavaTokens(nlLogic_text(r.arg)))
matches.put(var, str(callAndMake(r.name)));
}
}
}
}