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)

1  
static LS ai_dropFillers_advanced_once(S s) {
2  
  LS phrases = mL("Fillers");
3  
  LS tokOriginal = javaTokNPunctuation_cached(s);
4  
  LS tokS = cloneList(tokOriginal);
5  
  int n = l(tokS);
6  
  LL<S> tokPhrases = map javaTokNPunctuation_cached(phrases);
7  
  LL<S> tokNonFillers = map javaTokNPunctuation_cached(mL("Not fillers"));
8  
  
9  
  // Mark non-fillers with stars
10  
  for (int i = 1; i < n; i += 2)
11  
    for (LS tokPhrase : tokNonFillers)
12  
      if (codeTokenSubListEqualsIC(tokS, tokPhrase, i))
13  
        for (int j = i; j < i+l(tokPhrase)-1; j += 2)
14  
          tokS.set(j, "*");
15  
          
16  
  new LS out;
17  
  for (int i = 1; i < n; i += 2)
18  
    for (LS tokPhrase : tokPhrases)
19  
      if (codeTokenSubListEqualsIC(tokS, tokPhrase, i))
20  
        out.add(trimJoin(ai_dropTokens(tokOriginal, i, i+l(tokPhrase)-1)));
21  
  ret out;
22  
}

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: 272 / 307
Version history: 2 change(s)
Referenced in: [show references]