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

21
LINES

< > BotCompany Repo | #1017584 // Telegram Facts Bot v1 [Dyn Module, OK, but doesn't handle any variables]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 408K of libraries. Click here for Pure Java version (18234L/132K).

!7

set flag DynModule.

sclass TelegramFactsBot > AbstractTelegramThinkBot {
  void thinkAbout(S s) {
    new NLLogicChecker_v1 c;
    c.facts.addAll(mL("Random facts"));
    c.input = s;
  
    for (S rule : splitAtEmptyLines(mL_raw("NL Logic Examples"))) pcall {
      NLLogicChecker_v1.Matching m = new NLLogicChecker_v1.Matching();
      if (c.checkRule(nlLogic_parseRule(rule), m)) {
        for (Exp out : m.output)
          if (out cast Func)
            if (eq(out.name, "output") && out.arg instanceof Sentence)
              postMessage("Random facts say: " + join(((Sentence) out.arg).tok));
      }
    }
  }
}

Author comment

Began life as a copy of #1017583

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017584
Snippet name: Telegram Facts Bot v1 [Dyn Module, OK, but doesn't handle any variables]
Eternal ID of this version: #1017584/4
Text MD5: b062ee6206a2594c9fe081493f66be50
Transpilation MD5: 53941d66e4a3056250e26a71a275996f
Author: stefan
Category: javax / telegram
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-28 12:21:33
Source code size: 644 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 404 / 514
Version history: 3 change(s)
Referenced in: #1017593 - Telegram Facts Bot v2 [Dyn Module, with dollar vars, OK]