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

36
LINES

< > BotCompany Repo | #1002308 // Parser Bot

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

Libraryless. Click here for Pure Java version (2681L/18K/58K).

1  
!759
2  
3  
static Class parser;
4  
5  
p {
6  
  print("parser bot loading");
7  
  parser = hotwire_overBot("#1002328");
8  
  print("parser bot loaded");
9  
}
10  
11  
answer {
12  
  if (startsWithIgnoreCase(s, "parse ")) try {
13  
    O bot;
14  
    bot = getBot("#1002314"); // adjectives bot
15  
    if (bot != null)
16  
      callOpt(parser, "addDict", "adjective", get(bot, "adjectives"));
17  
  
18  
    bot = getBot("#1002342"); // nouns bot
19  
    if (bot != null)
20  
      callOpt(parser, "addDict", "noun", get(bot, "nouns"));
21  
  
22  
    S text = s.substring(5).trim();
23  
    boolean debug = text.startsWith("debug ");
24  
    if (debug) text = text.substring(5).trim();
25  
    
26  
    S a;
27  
    time {
28  
      a = (S) call(parser, "parse", text);
29  
    }
30  
    if (debug)
31  
      ret structure(get(parser, "recog"));
32  
    ret a + " [" + getLastTiming() + " ms, " + getOpt(parser, "timing") + " ms actual]";
33  
  } catch (Throwable e) {
34  
    ret exceptionToUser(e);
35  
  }
36  
}

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: #1002308
Snippet name: Parser Bot
Eternal ID of this version: #1002308/1
Text MD5: d5a872d87173099ca894914d477fec61
Transpilation MD5: 7a60aeece03c567020088a649fdd0ec0
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-01-07 17:39:03
Source code size: 920 bytes / 36 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 638 / 693
Referenced in: [show references]