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).

1  
!7
2  
3  
module CategorizeRandomSpeechLogLines {
4  
  S line, category, answer;
5  
  
6  
  start {
7  
    setModuleName("Categorize Random Speech Log Line (of " + n2(dm_speechLog(), "line") + ")");
8  
  }
9  
  
10  
  visualize {
11  
    JLabel lbl = makeBold(fontSizePlus(3, dm_centeredFieldLabel('line)));
12  
    awtCalcEvery(lbl,
13  
      0.0, 5.0, r { if (!mouseInComponent(dm_frame())) next() });
14  
    ret northCenterAndSouth(
15  
      withMargin(rightAlignedLine(jbutton("Next", rThread next))),
16  
      lbl,
17  
      withMargin(vstackWithSpacing(
18  
        westCenterAndEastWithMargin(jlabel("Is this line"),
19  
          dm_fieldTextField('category), jlabel("?")),
20  
        westCenterAndEastWithMargin(
21  
          leftAlignedButtons(
22  
            "Yes", rThread { save("yes") }, "No", rThread { save("no") }),
23  
          onEnter(dm_fieldTextField('answer), rThread save),
24  
          jbutton("Save", rThread save))
25  
      )));
26  
  }
27  
  
28  
  void save(S answer) enter { setField(+answer); save(); }
29  
  
30  
  void save enter {
31  
    if (empty(answer) || empty(line) || empty(category)) ret;
32  
    dm_callModule(dm_requireModule("#1020558/LineToCategory"),
33  
      'setAnswer, line, category, answer);
34  
    next();
35  
  }
36  
  
37  
  void next enter {
38  
    setField(line := random(dm_speechLog()));
39  
  }
40  
}

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: 241 / 631
Version history: 9 change(s)
Referenced in: [show references]