Download Jar. Libraryless. Click here for Pure Java version (16369L/117K).
1 | !7 |
2 | |
3 | sbool simplify = true; |
4 | sS background = #1009946; |
5 | static JDesktopPane desktop; |
6 | static ShadowJLabel lblInput; |
7 | static JLabel lblSpoiler; |
8 | static Canvas canvas; |
9 | static JButton btnParseOK, btnParseNotOK; |
10 | sbool auto = true; |
11 | static Bool parseOK; |
12 | static S input; |
13 | static Triple<S> triple; |
14 | |
15 | static Map<Pair<S, Triple<S>>, Bool> parseOKMap; |
16 | |
17 | p { |
18 | parseOKMap = persistentHashMap('parseOKMap); |
19 | autoRestart(); |
20 | nimbus(); |
21 | gac36k(); // preload |
22 | desktop = jTiledBackgroundDesktopPane(background); |
23 | autoFixDesktopPane(desktop); |
24 | cleanExitOnFrameClose(showMaximizedFrame(desktop)); |
25 | |
26 | lblInput = centerLabel(swingNu(ShadowJLabel)); |
27 | lblInput.setForeground(Color.yellow); |
28 | lblInput.setRightShadow(2, 3, Color.gray); |
29 | |
30 | setInternalFrameY(40, showCenteredInternalFrame(desktop, "Question", desktop.getWidth()-100, 150, |
31 | jBackground(Color.black, withBottomMargin(4, centerAndSouth( |
32 | jbold(setFont(#1011146, 35, lblInput)), |
33 | westAndEast( |
34 | withLeftMargin(10, setBoldFontSize(20, setForeground(Color.gray, lblSpoiler = jlabel()))), |
35 | withRightMargin(10, jbutton("Next", f next)))))))); |
36 | |
37 | setInternalFrameY(internalFrameY2(getInternalFrame(lblInput))+40, showCenteredInternalFrame(desktop, "Analysis", 600, 400, |
38 | centerAndSouth( |
39 | canvas = jcanvas(), |
40 | jcenteredline(jlabel("How is the parse?"), |
41 | btnParseOK = jbutton("OK", f parseOK), btnParseNotOK = jbutton("Not OK", f parseNotOK))))); |
42 | |
43 | next(); |
44 | |
45 | awtEvery(lblInput, 5000, r { |
46 | if (auto && !mouseInInternalFrames(canvas, lblInput)) next() |
47 | }); |
48 | |
49 | //hideConsole(); |
50 | } |
51 | |
52 | svoid next { |
53 | S s; |
54 | setText(lblInput, s = random_gac36k()); |
55 | setText(lblSpoiler, floatToYesNo(gac36k().get(s))); |
56 | analyze(); |
57 | } |
58 | |
59 | svoid analyze { |
60 | input = getTextTrim(lblInput); |
61 | triple = ai_tripelize(input); |
62 | parseOK = parseOKMap.get(pair(input, triple)); |
63 | buttons(); |
64 | Web web = webFromTriple(triple, 0.3, 0.2, 0.7, 0.7); |
65 | if (simplify) web_ai_addSimplifications(web); |
66 | canvas = webToCanvas(web, canvas); |
67 | } |
68 | |
69 | svoid parseOK { parseOK(true); } |
70 | svoid parseNotOK { parseOK(false); } |
71 | |
72 | svoid parseOK(bool ok) { |
73 | parseOKMap.put(pair(input, triple), parseOK = ok); |
74 | buttons(); |
75 | awtLater(lblInput, 1000, f next); |
76 | } |
77 | |
78 | svoid buttons { |
79 | setEnabled(btnParseOK, !isTrue(parseOK)); |
80 | setEnabled(btnParseNotOK, !isFalse(parseOK)); |
81 | } |
Began life as a copy of #1011118
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: | #1011156 |
Snippet name: | Auto GAC 2 [OK, with confirming parses] |
Eternal ID of this version: | #1011156/17 |
Text MD5: | db5618d8063d5204b979e878e6579140 |
Transpilation MD5: | 40156a875956dcf9d45797bdac10f30e |
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-10-19 06:04:10 |
Source code size: | 2385 bytes / 81 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 454 / 3315 |
Version history: | 16 change(s) |
Referenced in: | [show references] |