1 | svoid nlLogic_setScriptID(L<IfThen> rules, fS scriptID) { |
2 | final Set<S> ids = collectAsHashSet(rules, 'globalID); |
3 | for (IfThen rule : rules) { |
4 | rule.globalID = scriptID + rule.globalID; |
5 | mapIntoSameCollection(rule.options, func(S s) -> S { |
6 | new Matches m; |
7 | for (S pat : splitAtVerticalBar("trumps *|conflicts with")) |
8 | if (match(pat, s, m)) |
9 | ret format(pat, scriptID + $1); |
10 | ret s; |
11 | }); |
12 | nlLogic_visit(rule, voidfunc(O o) { |
13 | S name; |
14 | if (o cast Func) { |
15 | if (eq(o.name, 'followingUpOn)) { |
16 | L<S> tok = javaTok(nlLogic_text(o.arg)); |
17 | if (ids.contains(_get(tok, 1))) { |
18 | tok.set(1, scriptID + tok.get(1)); |
19 | o.arg = Sentence2(join(tok)); |
20 | } |
21 | } |
22 | } |
23 | }); |
24 | } |
25 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1017814 |
Snippet name: | nlLogic_setScriptID |
Eternal ID of this version: | #1017814/8 |
Text MD5: | 0936befcda06bf8699343d03cc6fbee9 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-08-14 21:44:19 |
Source code size: | 800 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 339 / 375 |
Version history: | 7 change(s) |
Referenced in: | [show references] |