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)

1  
static L<GazelleTree> gazelle_reasonWithPreprocessing(S input1, O... _) {
2  
  F0<GazelleEvalContext> contextMaker = cast assertNotNull("Need contextMaker", optPar contextMaker(_));
3  
  S userName = stringPar userName(_);
4  
  bool debug = boolPar debug(_);
5  
  bool debugPreprocessing = boolPar debugPreprocessing(_);
6  
  Collector<GInterpretable> interpretables_out = cast optPar interpretables_out(_);
7  
  
8  
  Collection<GInterpretable> interpretables = gazelle_preprocess(input1, _);
9  
  
10  
  if (debugPreprocessing) {
11  
    print("Got " + n2(interpretables, "interpretable") + ".");
12  
    printIndentLines(interpretables);
13  
  }
14  
  
15  
  if (interpretables != null) addAll(interpretables_out, interpretables); 
16  
  
17  
  Set<S> acceptablePurposes = cast optPar acceptablePurposes(_);
18  
  if (acceptablePurposes == null) acceptablePurposes = litset("");
19  
  
20  
  new L<GazelleTree> l2;
21  
  Set<S> outputs = ciSet();
22  
23  
  for (GInterpretable intp : interpretables) {
24  
    L<GazelleTree> results = dm_gazelle_reasonAboutChatInput_v2(userName, intp.text, paramsPlus(_, +acceptablePurposes));
25  
    print(intp.text + " => " + n2(results, "result"));
26  
    for (GazelleTree tree : results)
27  
      if (outputs.add(tree.line)) {
28  
        if (tree.mr != null) tree.mr.interpretable = intp;
29  
        l2.add(tree);
30  
      }
31  
  }
32  
  
33  
  gazelle_dropMatchedDefaultRules(l2, _);
34  
  
35  
  ret l2;
36  
}

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: 275 / 369
Version history: 25 change(s)
Referenced in: [show references]