static L<S> dropPunctuation_keep = ll("*", "<", ">"); static L<S> dropPunctuation(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)) && !dropPunctuation_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 dropPunctuation(S s) { ret join(dropPunctuation(nlTok(s))); }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney
No comments. add comment
Snippet ID: | #1000814 |
Snippet name: | dropPunctuation |
Eternal ID of this version: | #1000814/2 |
Text MD5: | 3a7b382cc003e763b3b4aa108e2cc03a |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-04-15 20:33:11 |
Source code size: | 549 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 855 / 7727 |
Version history: | 1 change(s) |
Referenced in: | [show references] |