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

36
LINES

< > BotCompany Repo | #1018274 // Two-Stage Input Processing Spike [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (16334L/122K).

!7

p-exp {
  S input = "tell me what's going on";
  
  new L<ExecutedRule> results;
  
  L<ExecutedRule> results1 = nlLogic_processInputOrFact(input, false, "Reduction rules 2");
  
  // Collect results of stage 1
  for (ExecutedRule r : results1)
    if (nempty(r.output) || nempty(r.facts)) {
      print("Result: " + sfu(r));
      results.add(r);
    }
  
  // Collect inputs for stage 2
  LinkedHashSet<S> newInputs = litorderedset(input);
  for (ExecutedRule r : results1)
    addAll(newInputs, r.newInput);

  for (S s : newInputs) {
    print("Stage 2: " + s);
    L<ExecutedRule> results2 = nlLogic_processInputOrFact(s, false, "<default>");

    // Collect results of stage 2
    for (ExecutedRule r : results2)
      if (nempty(r.output) || nempty(r.facts)) {
        print("Result: " + sfu(r));
        results.add(r);
      }
  }
  
  printAsciiHeading("Results");
  pnlStruct(results);
}

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: #1018274
Snippet name: Two-Stage Input Processing Spike [OK]
Eternal ID of this version: #1018274/9
Text MD5: b50ab1b1afe4a9f478afbaac29084934
Transpilation MD5: c8c6bb50f3a811f823e60e20e1a504e0
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-13 17:51:33
Source code size: 937 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 421 / 1042
Version history: 8 change(s)
Referenced in: [show references]