sclass AI_DatesBot > AttractorBot { Long now; public void run { say("I can resolve dates for you"); } // CONFIG class Attractor1 > Attractor { int month, day; public bool matches(S s) { new Matches m; if (find3("* of *", s, m)) { month = indexOfIC(englishMonthNames(), $2)+1; if (month >= 1) { day = or0(ai_indexToNr($1)); if (day > 0) true; } } if (find3("* * of *", s, m)) { if (!eqicOneOf($2, "th", "rd", "nd", "st")) false; month = indexOfIC(englishMonthNames(), $3)+1; if (month >= 1) { day = parseIntOpt($1); if (day > 0) true; } } false; } public void run { say(localYear(nowOr(now)) + "/" + formatInt(month, 2) + "/" + formatInt(day, 2)); } } *() { standardAttractors(new Attractor1); } }
Began life as a copy of #1022819
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1022834 |
Snippet name: | AI_DatesBot |
Eternal ID of this version: | #1022834/12 |
Text MD5: | 832f92222d3faafffd37bc9c8612caf5 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-04-09 23:51:30 |
Source code size: | 956 bytes / 43 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 385 / 825 |
Version history: | 11 change(s) |
Referenced in: | [show references] |