Download Jar. Libraryless. Click here for Pure Java version (10423L/76K).
!7 sS data = [[ User: Today I bought a {Big Mac} for 1 € Bot: Wow... that's cheap! Usually they cost like... how much? User: 5 € Bot: Yes, yes. So that's 80% off! ---- Test User: Today I bought a car for 50 € Bot: Wow... that's cheap! Usually they cost like... how much? User: 5000 € Bot: Yes, yes. So that's 99% off! ]]; p-exp { consoleWidthCenter(1000); SS sections = minusSignSections(data); F1<S, LS> tokenize = f<S, LS> javaTokWithBrackets; LPair<S> pairs = assertNotNull(zipTwoLists_strict( tlft(sections.get("")), tlft(sections.get("Test")))); pnl(pairs); SS map = ciMap(); for (PairS p : pairs) { LS tokA = callF(tokenize, p.a), tokB = callF(tokenize, p.b); if (l(tokA) != l(tokB)) continue with print("Mismatched token count, skipping: " + p); SS map2 = gazelle_zipTwoTokenizationsToMap(tokA, tokB); if (map2 == null) continue with warn("line not matchable: " + p); printIndent(map2); Set<S> newVars = setMinusSet(keys(map2), keys(map)); print("New vars: " + newVars); print(" Rule: " + p.b + " => " + joinWithComma(map joinPairWithSpacedEquals(mapBoth optCurly(mapToPairs(map2))))); if (!putAllStrictlyIC(map, map2)) warn("failure to merge maps"); } print(map); LS numberKeys = filter isInteger(keys(map)); L<Double> numbers = map parseDouble(numberKeys); S numFunc = null; if (l(numbers) > 1) { numFunc = ai_findNumberCalculationFunction1(numbers); if (numFunc != null) { print("Found number function: " + numFunc); LS numberValues = filter isInteger(values(map)); L<Double> numbers2 = map parseDouble(numberValues); if (ai_checkNumberCalculationFunction1(numFunc, numbers2)) print("Number function verifies."); else { print("Number function doesn't verify."); numFunc = null; } } } }
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: | #1021599 |
Snippet name: | "Big Mac" Demo [Prelude] |
Eternal ID of this version: | #1021599/23 |
Text MD5: | 3329109ea4b448d770ffe6545ca7f832 |
Transpilation MD5: | 48cdb60aa9c90ab28dc20bf0f3b6dbaa |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-02-22 10:58:33 |
Source code size: | 1947 bytes / 60 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 606 / 1663 |
Version history: | 22 change(s) |
Referenced in: | [show references] |