static L gazelle_getChildren(GazelleTree tree, O... _) { if (tree == null) null; if (tree.children != null) ret tree.children; tree.children = new L; double qualityCutOff = optPar qualityCutOff(_, -0.75); LS dialogHistory = optPar dialogHistory(_); // make rule engine etc. if (tree.ctx == null) tree.ctx = assertNotNull('evalContext, (GazelleEvalContext) callF(assertNotNull('makeEvalContext, optPar makeEvalContext(_)))); GazelleEvalContext ctx = tree.ctx; RuleEngine2 engine = ctx.engine; SS inputMap = litmap(standard := tree.line); LS history = concatLists(dialogHistory, tree.history()); for (int i = 0; i < l(history); i++) inputMap.put("dialog-" + (l(history)-i), history.get(i)); // Splitters for (RuleEngine2.SimplifyWithRule rule : engine.splitterRules()) pcall { O f = rule.function(); Collection out = cast(f instanceof S ? callF(engine.callFunctionOnString, (S) f, tree.line) : callF(f, tree.line)); if (l(out) < 2) continue; GazelleTree child = new(joinWithVBar(out)); child.isSplitNode = true; tree.add(child); for (S line : out) child.add(GazelleTree(line)); } // Other rules L l = sortByMethodDesc qualitySum(ai_ruleEngine2_rulesForInput_5_allConditions(engine, inputMap, debug := false, +tree)); //print("Got rules: " + l(l)); for (RuleEngine2_MatchedRule r : l) { if (r.relativeQuality() < qualityCutOff) continue; S line = r.outText(); GazelleTree child = new(line); child.parent = tree; child.ctx = tree.ctx; child.mr = r; ai_gazelle_analyzeStatementsForRule_Data data = ctx.dataByRule.get(r.rule.globalID); child.prediction = data == null ? null : ai_gazelle_predictor1_onData(r, data); children.add(child); } sortByCalculatedFieldDesc(children, func(GazelleTree c) -> int { ai_goodBadToInt(c.prediction) }); ret tree.children; }