Uses 911K of libraries. Click here for Pure Java version (12278L/68K).
!7 cmodule IWantYouToBePrelude > DynPrintLog { transient LS inputs = tlft([[ I want you to be my mother I want you to be my assistant ]]); // the facts transient Set<S> facts = tlft_ciSet([[ Computery is usery's assistant It is impossible that {Computery is usery's mother} ]]); // the rules transient WordTokRule rule_iWantYouToBe = wordTokReplacerRule( "I want you to be my assistant", "assistant", "I want that {you are my assistant}"); transient WordTokRule rule_useryWants = new WordTokRule("Usery wants that X", "X") { run { S x_simplified = simpleSpaces_nTok(getVar("X")); if (contains(facts, x_simplified)) emit(extMarkAs answer("But " + x_simplified + " already")); else if (contains(facts, "It is impossible that " + curly(x_simplified))) emit(extMarkAs answer("No way brother")); else if (debug) print("Can't decide on: " + x_simplified); } }; // rules by space transient MultiMap<S, WordTokRule> rulesForSpace = litmultimap( MultiSpaceReasoning1.userSpace, ll(rule_iWantYouToBe), MultiSpaceReasoning1.objectiveSpace, ll(rule_useryWants) ); start-thread-printDone { new MultiSpaceReasoning1 mr; mr.addRules(rulesForSpace); for (S input : printIterate_nl(inputs)) { Collection<ES> outputs = mr.reason_inputToAnswer(input); printLinesIndent("[Bot] ", extFilterByFlag answer(outputs)); } } }
Began life as a copy of #1023180
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1023210 |
Snippet name: | I want you to be... [prelude spike v4, extended strings, OK] |
Eternal ID of this version: | #1023210/19 |
Text MD5: | 91f78d9b185d63693b4739b051b93c0d |
Transpilation MD5: | 1a0d791c007675a4d81bbd06a4ca1b56 |
Author: | stefan |
Category: | javax / logic engines |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-06-27 00:09:01 |
Source code size: | 1508 bytes / 48 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 294 / 560 |
Version history: | 18 change(s) |
Referenced in: | [show references] |