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

23
LINES

< > TinyBrain | #1018221 - Facts from input v2 [OK]

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

Libraryless. Click here for Pure Java version (9487L/52K).

!7

p-exp {
  BakedBot bot = bakedBotWithRulesAndFacts([[
    [id: hbmitwbnclzyxxgu] anyInput() && $x, $y in eval(listToOverlappingPairs(words(ai_input())))
      => fact($_q_x and $_q_y are words next to each other)
    
    [id: bvkghqiwkxgkpmda] fact($_q_x and $_q_y are words next to each other)
      && fact($_q_x is a noun)
      && fact($_q_y is a noun)
      => fact[javaTokNoQuotes]("$x $y" is a noun)
  ]], [[
    "donald" is a noun
    "duck" is a noun
  ]]);
  
  setOpt(bot.factsBot(), useIterate := true);
  bot.imagineMode();
  
  bot.answer("hi donald duck yo");
  bot.answer("!imaginaryFacts");
  assertTrueVerbose(matchAny([["donald duck" is a noun]], print(bot.imaginedFacts())));
}

Author comment

Began life as a copy of #1018220

download  show line numbers  debug dex   

Travelled to 8 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tvejysmllsmz

No comments. add comment

Snippet ID: #1018221
Snippet name: Facts from input v2 [OK]
Eternal ID of this version: #1018221/10
Text MD5: ab78abf46196ebc47b967a24142c0665
Transpilation MD5: d58497878a458e8215d12c3ddec617c4
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-10 19:40:06
Source code size: 724 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 44 / 133
Version history: 9 change(s)
Referenced in: [show]