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

1  
!7
2  
3  
set flag DynModule.
4  
5  
sclass TelegramFactsBot > AbstractTelegramThinkBot {
6  
  void thinkAbout(S s) {
7  
    new NLLogicChecker_v1 c;
8  
    c.facts.addAll(mL("Random facts"));
9  
    c.input = s;
10  
  
11  
    for (S rule : splitAtEmptyLines(mL_raw("NL Logic Examples"))) pcall {
12  
      NLLogicChecker_v1.Matching m = new NLLogicChecker_v1.Matching();
13  
      if (c.checkRule(nlLogic_parseRule(rule), m)) {
14  
        for (Exp out : m.output)
15  
          if (out cast Func)
16  
            if (eq(out.name, "output") && out.arg instanceof Sentence)
17  
              postMessage("Random facts say: " + join(((Sentence) out.arg).tok));
18  
      }
19  
    }
20  
  }
21  
}

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: 316 / 408
Version history: 3 change(s)
Referenced in: [show references]