| 1 | static L<S> dropPunctuationExcept(L<S> tok, L<S> keep) {
 | 
| 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)) && !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 dropPunctuationExcept(S s, L<S> keep) {
 | 
| 16 | ret join(dropPunctuationExcept(nlTok(s), keep)); | 
| 17 | } | 
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: | 840 / 829 | 
| Referenced in: | [show references] |