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

40
LINES

< > BotCompany Repo | #1020561 // Categorize Random Speech Log Lines

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

Libraryless. Click here for Pure Java version (15120L/107K).

!7

module CategorizeRandomSpeechLogLines {
  S line, category, answer;
  
  start {
    setModuleName("Categorize Random Speech Log Line (of " + n2(dm_speechLog(), "line") + ")");
  }
  
  visualize {
    JLabel lbl = makeBold(fontSizePlus(3, dm_centeredFieldLabel('line)));
    awtCalcEvery(lbl,
      0.0, 5.0, r { if (!mouseInComponent(dm_frame())) next() });
    ret northCenterAndSouth(
      withMargin(rightAlignedLine(jbutton("Next", rThread next))),
      lbl,
      withMargin(vstackWithSpacing(
        westCenterAndEastWithMargin(jlabel("Is this line"),
          dm_fieldTextField('category), jlabel("?")),
        westCenterAndEastWithMargin(
          leftAlignedButtons(
            "Yes", rThread { save("yes") }, "No", rThread { save("no") }),
          onEnter(dm_fieldTextField('answer), rThread save),
          jbutton("Save", rThread save))
      )));
  }
  
  void save(S answer) enter { setField(+answer); save(); }
  
  void save enter {
    if (empty(answer) || empty(line) || empty(category)) ret;
    dm_callModule(dm_requireModule("#1020558/LineToCategory"),
      'setAnswer, line, category, answer);
    next();
  }
  
  void next enter {
    setField(line := random(dm_speechLog()));
  }
}

Author comment

Began life as a copy of #1020559

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020561
Snippet name: Categorize Random Speech Log Lines
Eternal ID of this version: #1020561/10
Text MD5: 1aae90a17509a54fed465bb632daac77
Transpilation MD5: 1ac7d751af288eb7295b29da9c68eae8
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-27 01:56:27
Source code size: 1262 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 234 / 623
Version history: 9 change(s)
Referenced in: [show references]