Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

20
LINES

< > BotCompany Repo | #1025900 // philosophyBot_processUnclearIfs

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7747L/50K).

svoid philosophyBot_processUnclearIfs(PhilosophyBot1 bot) {
  S var = "$" + aGlobalID();
  new Set<S> phrases;
  for (PhilosophyBot1.LogicRule rule : bot.logicRules) {
    S cond = optCast S(bot.leftmostCondition(rule.lhs)), continue if null;
    S phrase = mapGet(bot.zipIt_deBracket("unclear if " + var, cond), var), continue if null;
    if (phrases.add(phrase))
      print("Got unclear if: " + phrase);
  }
  if (empty(phrases)) ret;
  for (PhilosophyBot1.LogicRule rule : bot.allLogicRulesWithoutLHSVars()) {
    O leftmost = bot.leftmostCondition(rule.lhs);
    S cond = optCast S(leftmost), continue if null;
    if (!any(phrases, pat -> bot.zipIt(pat, cond) != null))
      continue with print("unclearIf not requested: " + cond);
    if (bot.hasFact(cond))
      continue with print("unclearIf has fact: " + cond);
    bot.addFact(print("unclearIf adding", "unclear if " + optRound(cond)));
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1025900
Snippet name: philosophyBot_processUnclearIfs
Eternal ID of this version: #1025900/13
Text MD5: 72dc4f6e0cdf47b0e07ad4d3283b4176
Transpilation MD5: cb50ccd76a865151f8331479d64dbaf0
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-28 15:14:42
Source code size: 925 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 164 / 278
Version history: 12 change(s)
Referenced in: [show references]