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

28
LINES

< > BotCompany Repo | #1020418 // Trained Interactions [dev.]

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

Libraryless. Click here for Pure Java version (18003L/134K).

1  
!7
2  
3  
srecord Line (
4  
  S type, // 'user, 'suggestion, 'bot, 'metaComment
5  
  S text
6  
) {}
7  
8  
concept Interaction {
9  
  new L<Line> lines;
10  
}
11  
12  
sS lineToString(Line line) {
13  
  ret lpad(10, firstToUpper(replaceCompleteValue(line.type, 'metaComment, 'comment))) + ": " + line.text;
14  
}
15  
16  
module TrainedInteractions > DynCRUD<Interaction> {
17  
  *() { super(Interaction); }
18  
19  
  // API
20  
  
21  
  void addInteraction(O interaction) {
22  
    L lines = cast get(interaction, 'lines);
23  
    cnew(Interaction, lines := map(lines, func(O line) -> Line {
24  
      shallowCloneToClassWithFields(line, Line, 'type, 'text)
25  
    }));
26  
    infoBox("Interaction saved.");
27  
  }
28  
}

Author comment

Began life as a copy of #1020415

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: #1020418
Snippet name: Trained Interactions [dev.]
Eternal ID of this version: #1020418/4
Text MD5: 1f6523a08ffe1ad2895fa63489e9b12e
Transpilation MD5: edb4d8a2a6ffbbf8250ba3ac9e2193fb
Author: stefan
Category: javax / stefan's os / a.i.
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-20 16:51:16
Source code size: 652 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 258 / 2311
Version history: 3 change(s)
Referenced in: [show references]