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

36
LINES

< > BotCompany Repo | #1022142 // gazelle_reasonWithPreprocessing - defaults to "" purpose

JavaX fragment (include)

static L<GazelleTree> gazelle_reasonWithPreprocessing(S input1, O... _) {
  F0<GazelleEvalContext> contextMaker = cast assertNotNull("Need contextMaker", optPar contextMaker(_));
  S userName = stringPar userName(_);
  bool debug = boolPar debug(_);
  bool debugPreprocessing = boolPar debugPreprocessing(_);
  Collector<GInterpretable> interpretables_out = cast optPar interpretables_out(_);
  
  Collection<GInterpretable> interpretables = gazelle_preprocess(input1, _);
  
  if (debugPreprocessing) {
    print("Got " + n2(interpretables, "interpretable") + ".");
    printIndentLines(interpretables);
  }
  
  if (interpretables != null) addAll(interpretables_out, interpretables); 
  
  Set<S> acceptablePurposes = cast optPar acceptablePurposes(_);
  if (acceptablePurposes == null) acceptablePurposes = litset("");
  
  new L<GazelleTree> l2;
  Set<S> outputs = ciSet();

  for (GInterpretable intp : interpretables) {
    L<GazelleTree> results = dm_gazelle_reasonAboutChatInput_v2(userName, intp.text, paramsPlus(_, +acceptablePurposes));
    print(intp.text + " => " + n2(results, "result"));
    for (GazelleTree tree : results)
      if (outputs.add(tree.line)) {
        if (tree.mr != null) tree.mr.interpretable = intp;
        l2.add(tree);
      }
  }
  
  gazelle_dropMatchedDefaultRules(l2, _);
  
  ret l2;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1022142
Snippet name: gazelle_reasonWithPreprocessing - defaults to "" purpose
Eternal ID of this version: #1022142/26
Text MD5: c6eb83b2106a410baf69b3c574f38d68
Author: stefan
Category: javax / gazelle
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-07 16:31:27
Source code size: 1363 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 374 / 438
Version history: 25 change(s)
Referenced in: [show references]