1 | static S dropWords(S s, L<S> words) { |
2 | ret dropWords_impl(s, asSet(toLowerCase(words))); |
3 | } |
4 | |
5 | static S dropWords(S s, S words) { |
6 | ret dropWords(s, splitWords(words)); |
7 | } |
8 | |
9 | static S dropWords(S s, S... words) { |
10 | ret dropWords_impl(s, asSet(toLowerCase(words))); |
11 | } |
12 | |
13 | static Set<S> dropWords_preprocess(S words) { |
14 | ret asSet(splitWords(toLowerCase(words))); |
15 | } |
16 | |
17 | static S dropWords(S s, Set<S> set) { |
18 | ret dropWords_impl(s, asCISet(set)); |
19 | } |
20 | |
21 | static S dropWords_impl(S s, Set<S> set) { |
22 | L<S> tok = nlTok(s); |
23 | for (int i = 1; i < l(tok); ) |
24 | if (set.contains(tok.get(i).toLowerCase())) |
25 | removeToken(tok, i); |
26 | else |
27 | i += 2; |
28 | ret join(tok); |
29 | } |
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: | #1001898 |
Snippet name: | dropWords - drop words out of an NL sentence |
Eternal ID of this version: | #1001898/3 |
Text MD5: | 61f83c59054fb83f3c410dd440530abb |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-06 08:56:05 |
Source code size: | 679 bytes / 29 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 722 / 1351 |
Version history: | 2 change(s) |
Referenced in: | [show references] |