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

1  
!752
2  
3  
p {
4  
  File f = getNewestFile(allEventLogs());
5  
  assertNotNull("Not chat log found", f);
6  
  printStructure(f);
7  
  L<S> log = collect(scanEventLogForPosts(f), "text");
8  
  printStructure("Log: ", log);
9  
  int i = lastIndexOfStartsWith(log, "!learn");
10  
  if (i < 0) { print("No !learn command found"); ret; }
11  
  
12  
  new Matches mm;
13  
  print("cmd: " + log.get(i));
14  
  assertTrue(match("!learn *-*", log.get(i), mm));
15  
  int m = mm.psi(0), n = mm.psi(1);
16  
  print("i=" + i +", m=" + m + ", n=" + n);
17  
  L<S> part = subList(log, i-n, i-m);
18  
  printStructureLines(part);
19  
  /*for (S s : part)
20  
    print(indent(s));*/
21  
}

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: 508 / 560
Referenced in: [show references]