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

17
LINES

< > BotCompany Repo | #1003078 // dropPunctuation2 - uses nlTok2

JavaX fragment (include)

static L<S> dropPunctuation2(L<S> tok) {
  tok = new ArrayList<S>(tok);
  for (int i = 1; i < tok.size(); i += 2) {
    S t = tok.get(i);
    if (t.length() == 1 && !Character.isLetter(t.charAt(0)) && !Character.isDigit(t.charAt(0)) /* && !dropPunctuation2_keep.contains(t)*/) {
      tok.set(i-1, tok.get(i-1) + tok.get(i+1));
      tok.remove(i);
      tok.remove(i);
      i -= 2;
    }
  }
  return tok;
}

static S dropPunctuation2(S s) {
  ret join(dropPunctuation(nlTok2(s)));
}

Author comment

Began life as a copy of #1000814

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003078
Snippet name: dropPunctuation2 - uses nlTok2
Eternal ID of this version: #1003078/1
Text MD5: 4009dc9c608248854701a547ccff6bfd
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-04-27 21:56:57
Source code size: 501 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 708 / 823
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)