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

20
LINES

< > BotCompany Repo | #1018293 // nlLogic_applyMetaRules

JavaX fragment (include)

static L<IfThen> nlLogic_applyMetaRules(L<IfThen> rules) {
  final L<IfThen> metaRules = nlLogic_filterByRHSConstructs(rules, 'construct);
  if (empty(metaRules)) ret rules;
  
  new L<IfThen> newRules;
  for (IfThen rule : rules)
    newRules.add(nlLogic_transformShallow(rule, func(Exp e) -> Exp {
      if (!e instanceof Sentence2) ret e;
      final new NLLogic_ConstructChecker c;
      S original = e.text();
      c.construct = original;
      applyNLLogicFacts_v3(c, voidfunc(Exp e) {
        if (e cast Func)
          if (eq(e.name, 'construct))
            c.construct = e.arg.text();
      }, metaRules);
      ret eq(c.construct, original) ? e : nlLogic_parseExpression(c.construct);
    }));
  ret newRules;   
}

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: #1018293
Snippet name: nlLogic_applyMetaRules
Eternal ID of this version: #1018293/4
Text MD5: 87b7489cae306053557903a2d372ab47
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-16 12:31:03
Source code size: 749 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 321 / 358
Version history: 3 change(s)
Referenced in: [show references]