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

20
LINES

< > BotCompany Repo | #1017901 // ai_activeRules - preprocesses them too

JavaX fragment (include)

static L<IfThen> ai_activeRules() { 
 time "ai_activeRules" {
  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);

  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 rules;
}

Author comment

Began life as a copy of #1017899

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: #1017901
Snippet name: ai_activeRules - preprocesses them too
Eternal ID of this version: #1017901/5
Text MD5: 99597634abb26e242350cc6766066a2e
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:46
Source code size: 646 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 362 / 391
Version history: 4 change(s)
Referenced in: [show references]