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

26
LINES

< > BotCompany Repo | #1002023 - Translate Bot

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

Libraryless. Click here for Pure Java version (1253L/8K/28K).

!752

static new MultiMap<S, S> m;

p {
  load("m");
}

answer {
  L<S> tok = javaTok(s);
  if (match3(javaTok("* = *"), tok, m)) {
    main.m.put(toLower(m.unq(0)), toLower(m.unq(1)));
    save("m");
    ret "ok";
  }


  if (eq(get(tok, l(tok)-4), "=") && eq(get(tok, l(tok)-2), "?")) {
    for (int i = 1; i < l(tok)-5; i += 2) {
      S x = last(main.m.get(toLower(tok.get(i))));
      if (x != null)
        tok.set(i, x);
    }
    ret join(tok.subList(0, l(tok)-5));
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002023
Snippet name: Translate Bot
Eternal ID of this version: #1002023/1
Text MD5: 0168e6091c2d2a5279684ab1b2f1299e
Transpilation MD5: 07ee727cdbe6de718dbe828d9a374fb3
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-14 02:28:36
Source code size: 504 bytes / 26 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 596 / 1231
Referenced in: [show references]

Formerly at http://tinybrain.de/1002023 & http://1002023.tinybrain.de