Libraryless. Click here for Pure Java version (17632L/126K).
1 | !7 |
2 | |
3 | sclass MatchInput > DynPrintLogWithInput { |
4 | start { |
5 | useLocalMechListCopies(true); |
6 | set serverMechList_raw_fresh_verbose; |
7 | } |
8 | |
9 | void update(S s) { |
10 | print("\n> " + s); |
11 | L<S> pats = mL("English sentence patterns"); |
12 | L<S> tok = javaTokWithAngleBracketsC(s); |
13 | printStruct(tok); |
14 | for (S pat : pats) { |
15 | L<S> tokPat; |
16 | tokPat = javaTokWithAngleBracketsC(pat); |
17 | L<Pair<S>> match = uniquify(dropTwinPairs(zipTwoListsToPairs_ifSameLength(tokPat, tok))); |
18 | if (match != null) { |
19 | print(" Result: Choose pattern " + quote(pat) + " for input " + quote(s) + " if match: " + sfu(match)); |
20 | for (Pair<S> p : match) |
21 | if (isAngleBracketed(p.a)) { |
22 | Set<S> entries = mechSetCI(plural_mech(deAngleBracket(p.a))); |
23 | //print("Found " + n2(entries, "entry", "entries") + " for " + p.a); |
24 | if (contains(entries, p.b)) |
25 | print(" Match!!"); |
26 | } |
27 | } |
28 | } |
29 | } |
30 | } |
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: | #1017192 |
Snippet name: | Match Input With Pattern v1 [Dyn Module, OK] |
Eternal ID of this version: | #1017192/24 |
Text MD5: | 254602a425183ae94c9fb6854450d273 |
Transpilation MD5: | fc500792b1b50a64b5569471f3b2d10a |
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-13 19:53:27 |
Source code size: | 988 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 384 / 587 |
Version history: | 23 change(s) |
Referenced in: | [show references] |