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

26
LINES

< > BotCompany Repo | #1001212 // Conversation improvement bot

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

Libraryless. Click here for Pure Java version (428L/4K/11K).

1  
// When talking to a bot, the need to remember its precise syntax
2  
// is a little annoying. Let's change that.
3  
4  
!747
5  
6  
m {
7  
  static S botID; // its program ID
8  
  static L<S> questions;
9  
  
10  
  p {
11  
    S program = loadSnippet(botID);
12  
    questions = findQuestionsInSource(program);
13  
  }
14  
  
15  
  static L<S> findQuestionsInSource(S src) {
16  
    L<S> tok = javaTok(src);
17  
    new L<S> questions;
18  
    for (int i = 1; i+4 < tok.size(); i += 2) {
19  
      if (tok.get(i).equals("match3") && tok.get(i+2).equals("(")
20  
        && isQuoted(tok.get(i+4))) {
21  
        questions.add(unquote(tok.get(i+4)));
22  
      }
23  
    }
24  
    return questions;
25  
  }
26  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001212
Snippet name: Conversation improvement bot
Eternal ID of this version: #1001212/1
Text MD5: c8d2657439677d76cfe9b039a794132c
Transpilation MD5: 820de225fc4fc3aa8f1bce8b70c4bf2a
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-02 15:10:03
Source code size: 643 bytes / 26 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 603 / 648
Referenced in: [show references]