Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

36
LINES

< > BotCompany Repo | #1017001 // Noun / Not a Noun (old)

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (16159L/115K).

!7

sclass NounNotANoun > DynModule {
  InputChooser inputChooser = new(this);
  transient SingleComponentPanel form;

  start {
    dm_useLocalMechListCopies();
  }

  visualize {
    ret northAndCenter(wrap(inputChooser), jfullcenter(form = singleComponentPanel()));
  }
  
  void update {
    if (form == null || !inputChooser.update()) ret;
    S input = inputChooser.input();
    print("input: " + input);
    L<S> words = uniquify(words(input));
    form.setComponentAndRevalidateParent(makeForm(pairsToParams(map(words,
      func(fS word) -> Pair<O> {
        ButtonGroup buttons = jradiobuttons("noun", "not a noun", "unclear");
        L<S> defs = generalDefinition_texts_withoutInvalids(word);
        bool a = cic(defs, "a noun"), b = cic(defs, "not a noun");
        bool c = a == b;
        selectRadioButton(buttons, c ? 2 : b ? 1 : 0);
        onRadioButtonChange(buttons, voidfunc(int i) {
          print(word + " => " + i);
          infoBox(linesLL(
            pairB(generalDefinitions_addOrRemove(word, "a noun", i == 0)),
            pairB(generalDefinitions_addOrRemove(word, "not a noun", i == 1))));
        });
        ret (Pair) pair(setFontSize(18, jRightAlignedLabel(quote(word))), hstack(buttonsInGroup(buttons)));
      }))));
  }
}

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: 496 / 1096
Version history: 25 change(s)
Referenced in: [show references]