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

29
LINES

< > BotCompany Repo | #1022341 // gazelle_processWithPurpose

JavaX fragment (include)

static Collection<GInterpretable> gazelle_processWithPurpose(S input1, S purpose, O... _) {
  Set<S> texts = litCISet();
  new L<GInterpretable> interpretables;
  int max = optPar max(_, 20);
  Collector<GInterpretable> collector = limitedCollector(interpretables, max);
  RuleEngine2 engine = ((F0<GazelleEvalContext>) optPar contextMaker(_)).get().engine;

  int nInterpreted = -1;
  
  bigLoop: while (!collector.full() && nInterpreted < l(interpretables)) {
    GInterpretable workingOn = get(interpretables, nInterpreted);
    S input = nInterpreted < 0 ? input1 : workingOn.text;
    S ruleBase = workingOn == null ? "" : workingOn.ruleID + "+";
    ++nInterpreted;
    
    for (RuleEngine2.SimplifyWithRule rule : engine.splitterRules()) pcall {
      for (S out : gazelle_executeSplitterRule(engine, rule, input))
        if (texts.add(out))
          if (collector.add(new GInterpretable(out, ruleBase + rule.globalID))) break bigLoop;
    }
    
    for (GazelleTree t : dm_gazelle_reasonAboutChatInput_v2(null, input, 
      paramsPlus(_, skipSplitters := true, acceptablePurposes := litset(purpose), skipUserName := true, skipUserID := true)))
        if (texts.add(t.line))
          if (collector.add(new GInterpretable(t.line, ruleBase + t.ruleID()))) break bigLoop;
  }
      
  ret interpretables;
}

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: 238 / 279
Referenced in: [show references]