Warning: session_start(): open(/var/lib/php/sessions/sess_t1ggp8qp3dvif4n9koqgrsb0is, 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
!include once #1027167 // Compact Module Include 2 v2
module WinogradSolver1 > DynSingleFunctionWithPrintLog {
transient PhilosophyBot1 engine;
transient O multiStage; // unused
S prelude = "import bool";
void doIt {
S input = "Bob paid for Charlie's college education. He is very [generous/grateful]. Who is [generous/grateful]?";
for (int variant = 1; variant <= 2; variant++) {
// Stage 1: take one option out of square brackets
S input2 = winograd_takeOption(variant, input);
if (empty(input2)) continue;
print(input2);
dm_call(multiStage, 'addStage, "Take variant " + variant, input2);
// Stage 1b: Split off 's
S input2b = ai_splitOffApostropheS(input2);
dm_call(multiStage, 'addStage, "Split off 's", input2b);
// Stage 1c: Split into sentences
LS sentences = map dropQuestionMark(sentences(input2b));
dm_call(multiStage, 'addStage, "Split into sentences", sentences);
// Stage 2: Parser
S parser = dm_makeModule("#1027108/TopDownParsing");
//L parsed = map(sentences, s -> dm_call(parser, 'parse, s));
L> parsed = map(sentences, s -> (Cl) dm_call(parser, 'parseToGroupings, s));
pnl(parsed);
Set allGroupings = concatListsToCISet(parsed);
print("Have " + n2(allGroupings, "grouping"));
dm_call(multiStage, 'addStage, "Parser", parsed);
// Stage 3a: Select the right rules for the task
Cl allRules = dm_getUnclearList("Rules"); // take all for now
// Stage 3b: Run logic engine
S program = joinWithEmptyLines(concatLists(ll(prelude), allGroupings, allRules));
engine = PhilosophyBot1(program);
engine.think();
for (SS map : engine.matchFacts("the answer to $x is $y"))
if (allGroupings.contains($x(map)))
printAfterNewLine("ANSWER>> " + $x(map) + ": " + $y(map));
print();
}
}
}