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

!7

srecord Line (
  S type, // 'user, 'suggestion, 'bot, 'metaComment
  S text
) {}

concept Interaction {
  new L<Line> lines;
}

sS lineToString(Line line) {
  ret lpad(10, firstToUpper(replaceCompleteValue(line.type, 'metaComment, 'comment))) + ": " + line.text;
}

module TrainedInteractions > DynCRUD<Interaction> {
  *() { super(Interaction); }

  // API
  
  void addInteraction(O interaction) {
    L lines = cast get(interaction, 'lines);
    cnew(Interaction, lines := map(lines, func(O line) -> Line {
      shallowCloneToClassWithFields(line, Line, 'type, 'text)
    }));
    infoBox("Interaction saved.");
  }
}

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: 255 / 2308
Version history: 3 change(s)
Referenced in: [show references]