static L<S> dropPunctuationExcept(L<S> tok, L<S> keep) { 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)) && !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 dropPunctuationExcept(S s, L<S> keep) { ret join(dropPunctuationExcept(nlTok(s), keep)); }
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: | #1002702 |
Snippet name: | dropPunctuationExcept |
Eternal ID of this version: | #1002702/1 |
Text MD5: | cb769214937eb19b176fc227cce6117e |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-02-15 21:51:52 |
Source code size: | 522 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 629 / 600 |
Referenced in: | [show references] |