Libraryless. Click here for Pure Java version (16159L/115K).
1 | !7 |
2 | |
3 | sclass NounNotANoun > DynModule { |
4 | InputChooser inputChooser = new(this); |
5 | transient SingleComponentPanel form; |
6 | |
7 | start { |
8 | dm_useLocalMechListCopies(); |
9 | } |
10 | |
11 | visualize { |
12 | ret northAndCenter(wrap(inputChooser), jfullcenter(form = singleComponentPanel())); |
13 | } |
14 | |
15 | void update { |
16 | if (form == null || !inputChooser.update()) ret; |
17 | S input = inputChooser.input(); |
18 | print("input: " + input); |
19 | L<S> words = uniquify(words(input)); |
20 | form.setComponentAndRevalidateParent(makeForm(pairsToParams(map(words, |
21 | func(fS word) -> Pair<O> { |
22 | ButtonGroup buttons = jradiobuttons("noun", "not a noun", "unclear"); |
23 | L<S> defs = generalDefinition_texts_withoutInvalids(word); |
24 | bool a = cic(defs, "a noun"), b = cic(defs, "not a noun"); |
25 | bool c = a == b; |
26 | selectRadioButton(buttons, c ? 2 : b ? 1 : 0); |
27 | onRadioButtonChange(buttons, voidfunc(int i) { |
28 | print(word + " => " + i); |
29 | infoBox(linesLL( |
30 | pairB(generalDefinitions_addOrRemove(word, "a noun", i == 0)), |
31 | pairB(generalDefinitions_addOrRemove(word, "not a noun", i == 1)))); |
32 | }); |
33 | ret (Pair) pair(setFontSize(18, jRightAlignedLabel(quote(word))), hstack(buttonsInGroup(buttons))); |
34 | })))); |
35 | } |
36 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1017001 |
Snippet name: | Noun / Not a Noun (old) |
Eternal ID of this version: | #1017001/26 |
Text MD5: | 8a4b21e627bb740ff883cbced1f7d467 |
Transpilation MD5: | 75c806dcd99f50e217ffa11a54dc859c |
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: | 2019-01-09 19:19:12 |
Source code size: | 1299 bytes / 36 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 497 / 1097 |
Version history: | 25 change(s) |
Referenced in: | [show references] |