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

22
LINES

< > BotCompany Repo | #1022248 // ai_dropFillers_advanced_once

JavaX fragment (include)

static LS ai_dropFillers_advanced_once(S s) {
  LS phrases = mL("Fillers");
  LS tokOriginal = javaTokNPunctuation_cached(s);
  LS tokS = cloneList(tokOriginal);
  int n = l(tokS);
  LL<S> tokPhrases = map javaTokNPunctuation_cached(phrases);
  LL<S> tokNonFillers = map javaTokNPunctuation_cached(mL("Not fillers"));
  
  // Mark non-fillers with stars
  for (int i = 1; i < n; i += 2)
    for (LS tokPhrase : tokNonFillers)
      if (codeTokenSubListEqualsIC(tokS, tokPhrase, i))
        for (int j = i; j < i+l(tokPhrase)-1; j += 2)
          tokS.set(j, "*");
          
  new LS out;
  for (int i = 1; i < n; i += 2)
    for (LS tokPhrase : tokPhrases)
      if (codeTokenSubListEqualsIC(tokS, tokPhrase, i))
        out.add(trimJoin(ai_dropTokens(tokOriginal, i, i+l(tokPhrase)-1)));
  ret out;
}

Author comment

Began life as a copy of #1022230

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1022248
Snippet name: ai_dropFillers_advanced_once
Eternal ID of this version: #1022248/3
Text MD5: 07de430a741c271cdc639b612760c598
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-12 00:54:46
Source code size: 823 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 271 / 306
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)