Download Jar. Libraryless. Click here for Pure Java version (15156L/108K).
!7 sS pattern = [[ CirclesAndLines(circles=[Circle(text="An operation", traits=[], x=d("0.27"), y=d("0.48")), Circle(text="A standard function", traits=[], x=d("0.72"), y=d("0.48"))], lines=[Arrow(a=t5, b=t31, text="is done by", traits=[])], title="An operation") ]]; sS input = [[ CirclesAndLines(circles=[Circle(text="\"Loading a snippet\"", traits=[], x=d("0.27"), y=d("0.48")), Circle(text="loadSnippet", traits=[], x=d("0.72"), y=d("0.48")), Circle(text="one argument", traits=[], x=d("0.49"), y=d("0.74")), Circle(text="a snippet ID", traits=[], x=d("0.72"), y=d("0.74"))], lines=[Arrow(a=t5, b=t31, text="is done by", traits=[]), Arrow(a=t5, b=t57, text="takes", traits=[]), Arrow(a=t57, b=t83, text="which is", traits=[])], title="\"Loading a snippet\"") ]]; sS then = [[ CirclesAndLines(circles=[Circle(text="An operation", traits=[], x=d("0.27"), y=d("0.48")), Circle(text="some time", traits=[], x=d("0.69"), y=d("0.48"))], lines=[Arrow(a=t5, b=t31, text="takes", traits=[])], title="An operation") ]]; p { Web patternWeb = parseWeb(pattern); Web inputWeb = parseWeb(input), originalInputWeb = cloneWeb(inputWeb); Web thenWeb = parseWeb(then); Map<WebNode> match = web_matchAllPerms_partial(patternWeb, inputWeb, Double.NaN); print("Score: " + web_matchAllPerms_partial_score!); print("Match: " + match); web_addLabelsFromNodeToNode(match); pnl(match); Web step4 = cloneWeb(inputWeb); Pair<WebNode> p = web_bestNodeMatch(thenWeb, step4); if (p != null) web_copyUsingPartialMap(thenWeb, step4, litmap(p.a, p.b)); CirclesAndLines.staticPopupExtender = voidfunc(final CirclesAndLines cal, final Canvas canvas, JPopupMenu menu) { addMenuItem(menu, jmenu("Operations", "First labels only", r { cal_dropSecondaryLabels(cal); canvas.update(); })); }; showTabbedWebs("Pattern", patternWeb, "Input", originalInputWeb, "Result", inputWeb, "Then", step4); print(ai_allUnclearLabels()); }
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: | #1010593 |
Snippet name: | Match & Copy Labels [dev.] |
Eternal ID of this version: | #1010593/12 |
Text MD5: | 6a94cfce87b7c6c92f621d822645f500 |
Transpilation MD5: | 50b5a4daf919918d00efa0ae6e320ed2 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-09-22 19:15:17 |
Source code size: | 1990 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 575 / 1295 |
Version history: | 11 change(s) |
Referenced in: | -