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

29
LINES

< > BotCompany Repo | #1022341 // gazelle_processWithPurpose

JavaX fragment (include)

1  
static Collection<GInterpretable> gazelle_processWithPurpose(S input1, S purpose, O... _) {
2  
  Set<S> texts = litCISet();
3  
  new L<GInterpretable> interpretables;
4  
  int max = optPar max(_, 20);
5  
  Collector<GInterpretable> collector = limitedCollector(interpretables, max);
6  
  RuleEngine2 engine = ((F0<GazelleEvalContext>) optPar contextMaker(_)).get().engine;
7  
8  
  int nInterpreted = -1;
9  
  
10  
  bigLoop: while (!collector.full() && nInterpreted < l(interpretables)) {
11  
    GInterpretable workingOn = get(interpretables, nInterpreted);
12  
    S input = nInterpreted < 0 ? input1 : workingOn.text;
13  
    S ruleBase = workingOn == null ? "" : workingOn.ruleID + "+";
14  
    ++nInterpreted;
15  
    
16  
    for (RuleEngine2.SimplifyWithRule rule : engine.splitterRules()) pcall {
17  
      for (S out : gazelle_executeSplitterRule(engine, rule, input))
18  
        if (texts.add(out))
19  
          if (collector.add(new GInterpretable(out, ruleBase + rule.globalID))) break bigLoop;
20  
    }
21  
    
22  
    for (GazelleTree t : dm_gazelle_reasonAboutChatInput_v2(null, input, 
23  
      paramsPlus(_, skipSplitters := true, acceptablePurposes := litset(purpose), skipUserName := true, skipUserID := true)))
24  
        if (texts.add(t.line))
25  
          if (collector.add(new GInterpretable(t.line, ruleBase + t.ruleID()))) break bigLoop;
26  
  }
27  
      
28  
  ret interpretables;
29  
}

Author comment

Began life as a copy of #1022190

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1022341
Snippet name: gazelle_processWithPurpose
Eternal ID of this version: #1022341/1
Text MD5: ce72166a739f80a74dfce50f39252593
Author: stefan
Category: javax / gazelle
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-15 01:22:22
Source code size: 1345 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 240 / 282
Referenced in: [show references]