Libraryless. Click here for Pure Java version (1723L/11K/38K).
!759 static new Map<S, S> thesaurusMap; p { load("thesaurusMap"); } synchronized answer { if "add thesaurus2 * *" { S key = m.unq(0), value = m.unq(1); if (match(key, value)) ret "You nasty rascal, don't do the endless loop!"; thesaurusMap.put(key, value); save("thesaurusMap"); ret "OK, saved! Thesaurus size now: " + l(thesaurusMap); } if "remove thesaurus2 *" { S key = m.unq(0); ret thesaurusMap.remove(key) != null ? "Removed." : "Not found..."; } if "thesaurus2 size" ret lstr(thesaurusMap); if "list thesaurus2" ret structure(thesaurusMap); for (S key : keys(thesaurusMap)) if (match(key, s, m)) { S a = askSelf(rewrite(thesaurusMap.get(key), m)); if (nempty(a)) { getInvolvedBots().add(formatSnippetID(programID())); ret a; } } } static S rewrite(S pattern, Matches m) { for (int i = 0; i < l(m.m); i++) m.m[i] = unquote(m.m[i]); ret format(pattern, m.m); }
Began life as a copy of #1002480
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: | #1002524 |
Snippet name: | Wildcard Thesaurus Bot (LIVE) |
Eternal ID of this version: | #1002524/1 |
Text MD5: | 6a8323678fa37863109b6169a79aac28 |
Transpilation MD5: | a1a0fb42c5454b98c90ff0ab25a13ad7 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-04-16 18:21:21 |
Source code size: | 1032 bytes / 44 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 698 / 1204 |
Referenced in: | [show references] |