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

!759

static Class parser;

p {
  print("parser bot loading");
  parser = hotwire_overBot("#1002328");
  print("parser bot loaded");
}

answer {
  if (startsWithIgnoreCase(s, "parse ")) try {
    O bot;
    bot = getBot("#1002314"); // adjectives bot
    if (bot != null)
      callOpt(parser, "addDict", "adjective", get(bot, "adjectives"));
  
    bot = getBot("#1002342"); // nouns bot
    if (bot != null)
      callOpt(parser, "addDict", "noun", get(bot, "nouns"));
  
    S text = s.substring(5).trim();
    boolean debug = text.startsWith("debug ");
    if (debug) text = text.substring(5).trim();
    
    S a;
    time {
      a = (S) call(parser, "parse", text);
    }
    if (debug)
      ret structure(get(parser, "recog"));
    ret a + " [" + getLastTiming() + " ms, " + getOpt(parser, "timing") + " ms actual]";
  } catch (Throwable e) {
    ret exceptionToUser(e);
  }
}

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