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: 861 / 1574
Referenced in: #3000195 - Answer for stefanreich (>> y)
#3000196 - Answer for stefanreich (>> y)
#3000197 - Answer for stefanreich (>> program data sizes)
#3000198 - Answer for stefanreich (>> program data sizes)
#3000199 - Answer for stefanreich (>> program data sizes)
#3000200 - Answer for stefanreich (>> program data sizes)
#3000201 - Answer for stefanreich (>> list all files)
#3000202 - Answer for stefanreich (>> T conversion bot)
#3000238 - Answer for stefanreich (>> t power bot)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)