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

21
LINES

< > BotCompany Repo | #1003979 // Process !learn command in latest chat log

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (2168L/14K/47K).

!752

p {
  File f = getNewestFile(allEventLogs());
  assertNotNull("Not chat log found", f);
  printStructure(f);
  L<S> log = collect(scanEventLogForPosts(f), "text");
  printStructure("Log: ", log);
  int i = lastIndexOfStartsWith(log, "!learn");
  if (i < 0) { print("No !learn command found"); ret; }
  
  new Matches mm;
  print("cmd: " + log.get(i));
  assertTrue(match("!learn *-*", log.get(i), mm));
  int m = mm.psi(0), n = mm.psi(1);
  print("i=" + i +", m=" + m + ", n=" + n);
  L<S> part = subList(log, i-n, i-m);
  printStructureLines(part);
  /*for (S s : part)
    print(indent(s));*/
}

Author comment

Began life as a copy of #1003969

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003979
Snippet name: Process !learn command in latest chat log
Eternal ID of this version: #1003979/1
Text MD5: 79d2fe0a4277c2a54e5421c26e04dd8a
Transpilation MD5: f42788c2ffe91e6253d973c99f5aaf1d
Author: stefan
Category: javax / talking robots
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-01 02:43:12
Source code size: 622 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 509 / 561
Referenced in: #1004871 - Process "Brainstorm" [Sim Predict, dev.]