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).

1  
svoid philosophyBot_processUnclearIfs(PhilosophyBot1 bot) {
2  
  S var = "$" + aGlobalID();
3  
  new Set<S> phrases;
4  
  for (PhilosophyBot1.LogicRule rule : bot.logicRules) {
5  
    S cond = optCast S(bot.leftmostCondition(rule.lhs)), continue if null;
6  
    S phrase = mapGet(bot.zipIt_deBracket("unclear if " + var, cond), var), continue if null;
7  
    if (phrases.add(phrase))
8  
      print("Got unclear if: " + phrase);
9  
  }
10  
  if (empty(phrases)) ret;
11  
  for (PhilosophyBot1.LogicRule rule : bot.allLogicRulesWithoutLHSVars()) {
12  
    O leftmost = bot.leftmostCondition(rule.lhs);
13  
    S cond = optCast S(leftmost), continue if null;
14  
    if (!any(phrases, pat -> bot.zipIt(pat, cond) != null))
15  
      continue with print("unclearIf not requested: " + cond);
16  
    if (bot.hasFact(cond))
17  
      continue with print("unclearIf has fact: " + cond);
18  
    bot.addFact(print("unclearIf adding", "unclear if " + optRound(cond)));
19  
  }
20  
}

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: 228 / 362
Version history: 12 change(s)
Referenced in: [show references]