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

28
LINES

< > BotCompany Repo | #1017899 // ai_activeRulesAndFacts - preprocesses them too

JavaX fragment (include)

static Pair<L<IfThen>, LS> ai_activeRulesAndFacts() { 
  ret ai_activeRulesAndFacts(null);
}

static Pair<L<IfThen>, LS> ai_activeRulesAndFacts(LS extraFacts) { 
 time "ai_activeRulesAndFacts" {
  LS facts = concatLists_conservative(extraFacts, mL_facts());
  
  LS unparsedRules = ai_unparsedTalkRules();
  
  for (S listName : mL("Rule & Fact Lists"))
    for (S x : splitAtEmptyLines(mL_raw(listName)))
      if (anyJavaTokens(x))
        if (nlLogic_parseRule(x) != null)
          unparsedRules.add(x);
        else
          facts.add(x);

  unparsedRules = sortedByCalculatedField(unparsedRules, func(S s) { jcontains(s, "entity(") });
  L<IfThen> rules = map_pcall nlLogic_parseRule(unparsedRules);
  
  for (S listName : mL("Default active scripts"))
    addAll(rules, nlLogic_loadMechScript(listName));
  
  nlLogic_expandMacros(rules);
 }
 ret pair(rules, facts);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017899
Snippet name: ai_activeRulesAndFacts - preprocesses them too
Eternal ID of this version: #1017899/7
Text MD5: 9e4e51020144abaee104c72e85119e2a
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-29 15:35:32
Source code size: 903 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 482 / 531
Version history: 6 change(s)
Referenced in: [show references]