Libraryless. Click here for Pure Java version (18221L/130K).
!7 sclass MatchInput > DynPrintLogWithInput { start { dm_useLocallyCopiedMechLists(); } void update(S s) { print("\n> " + s); L<S> pats = mL("English sentence patterns"); L<S> tok = javaTokWithAngleBracketsC(s); printStruct(tok); PlanInMotion<S> plan = new(pats); L<Pair<S, L<Pair<S>>>> results = new L; // pattern + match for (S pat : plan.master()) { L<S> tokPat; tokPat = javaTokWithAngleBracketsC(pat); L<Pair<S>> match = uniquify(dropTwinPairsIC(zipTwoListsToPairs_ifSameLength(tokPat, tok))); if (match != null) { print(" Result: Choose pattern " + quote(pat) + " for input " + quote(s) + " if match: " + sfu(match)); results.add(pair(pat, match)); } } // reduce from mech lists for (Pair<S, L<Pair<S>>> p : results) { L<Pair<S>> match = antiFilter(f parsing_checkMatchPairUsingMechList, p.b); if (l(match) < l(p.b)) { print(" Reduced match to: " + sfu(match)); p.b = match; } } print(); pnlStruct(sortedByComparator(results, (Comparator) lengthOfPairBListComparator())); } }
Began life as a copy of #1017199
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1017205 |
Snippet name: | Match Input With Pattern v3 [Dyn Module, dev.] |
Eternal ID of this version: | #1017205/6 |
Text MD5: | b0fabe413c772cf8dedc775682f665a6 |
Transpilation MD5: | 363eb251fe59eb9070ebbda63b81a6e9 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-07-14 02:03:04 |
Source code size: | 1172 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 434 / 608 |
Version history: | 5 change(s) |
Referenced in: | [show references] |