static L<GazelleTree> 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 = cast optPar dialogHistory(_); bool debug = boolPar debug(_); // make rule engine etc. if (tree.ctx == null) tree.setContext(assertNotNull('evalContext, (GazelleEvalContext) callF(assertNotNull('makeEvalContext, (O) optPar makeEvalContext(_))))); GazelleEvalContext ctx = tree.ctx; RuleEngine2 engine = ctx.engine; SS inputMap = gazelle_inputMapFromLineAndHistory(tree.line, concatLists(dialogHistory, tree.history())); if (boolPar respondingToHuman(_)) inputMap.put("_respondingToHuman" := "true"); if (debug) print("inputMap=" + sfu(asTreeMap(inputMap))); // Splitters if (!boolPar skipSplitters(_)) for (RuleEngine2.SimplifyWithRule rule : engine.splitterRules()) pcall { Collection<S> out = gazelle_executeSplitterRule(engine, rule, tree.line); if (empty(out)) continue; GazelleTree child = new(joinWithVBar(out)); child.ctx = ctx; child.isSplitNode = true; tree.add(child); for (S line : out) child.add(GazelleTree(line)); } // Other rules bool firstConditionOnly = boolPar firstConditionOnly(_); O[] params = litobjectarray(debug := optPar debug(_), +tree); L<RuleEngine2_MatchedRule> l = sortByMethodDesc qualitySum( firstConditionOnly ? ai_ruleEngine2_rulesForInput_5(engine, inputMap, params) : ai_ruleEngine2_rulesForInput_5_allConditions(engine, inputMap, params)); //print("Got rules: " + l(l)); for (RuleEngine2_MatchedRule r : l) { double quality = r.relativeQuality(); double cutOff = qualityCutOff; if (r.rule != null && r.rule.qualityCutOff != null) cutOff = r.rule.qualityCutOff; if (quality < cutOff && boolPar skipBad(_, true)) { if (debug) print("Match under quality (" + quality + "/" + qualityCutOff + "): " + r); continue; } S line = r.outText(); GazelleTree child = new(line); child.ctx = ctx; child.mr = r; if (r.rule != null) child.lineType = r.rule.outType(); // TODO: there can be multiple out types gazelle_addPredictionToTreeNode(child); tree.add(child); } gazelle_sortChildren(tree); ret tree.children; }
Began life as a copy of #1021522
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1021556 |
Snippet name: | gazelle_getChildren |
Eternal ID of this version: | #1021556/51 |
Text MD5: | 29bdb3cd568053db7267cef32792e1b2 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-22 15:50:42 |
Source code size: | 2450 bytes / 67 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 450 / 567 |
Version history: | 50 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1022416 - gazelle_getChildren_withContinuations |