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)

1  
static L<S> dropPunctuation2(L<S> tok) {
2  
  tok = new ArrayList<S>(tok);
3  
  for (int i = 1; i < tok.size(); i += 2) {
4  
    S t = tok.get(i);
5  
    if (t.length() == 1 && !Character.isLetter(t.charAt(0)) && !Character.isDigit(t.charAt(0)) /* && !dropPunctuation2_keep.contains(t)*/) {
6  
      tok.set(i-1, tok.get(i-1) + tok.get(i+1));
7  
      tok.remove(i);
8  
      tok.remove(i);
9  
      i -= 2;
10  
    }
11  
  }
12  
  return tok;
13  
}
14  
15  
static S dropPunctuation2(S s) {
16  
  ret join(dropPunctuation(nlTok2(s)));
17  
}

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