Uses 911K of libraries. Click here for Pure Java version (19615L/109K).
1 | !7 |
2 | |
3 | set flag DynModule. |
4 | |
5 | cmodule TestBot > DynObjectTable<ExecutedRule> { |
6 | InputChooser inputChooser = new(this); |
7 | S source, facts, rules; |
8 | S inputAs = "Input:"; // "Input:" or "Fact:" |
9 | bool allowUnsafeEvals; |
10 | |
11 | start { |
12 | dm_useLocalMechListCopies(); |
13 | set transpileRaw_useDiskCache; |
14 | inputChooser.delay = 1000; |
15 | itemToMap = itemToMap_ExecutedRule_v2(); |
16 | } |
17 | |
18 | visualize { |
19 | ret withMargin(northCenterAndSouth(vstackWithSpacing( |
20 | westCenterAndEast(dm_fieldComboBox('inputAs, |
21 | ll("Input:", "Fact:")), |
22 | wrap(inputChooser), |
23 | withLeftMargin(jbutton("Compute", rThread compute))) |
24 | ), |
25 | jvsplit(super.visualize(), |
26 | jhsplit( |
27 | withTitle("Facts", jLiveValueWordWrapTypeWriterTextArea_bothWays(dm_fieldLiveValue('facts))), |
28 | withTitle("Rules", jLiveValueWordWrapTypeWriterTextArea_bothWays(dm_fieldLiveValue('rules))), 0.5, 100), 0.2, 100 |
29 | ), |
30 | dm_fieldCheckBox('allowUnsafeEvals))); |
31 | } |
32 | |
33 | void compute { update(inputChooser.input()); } |
34 | |
35 | void update { if (inputChooser.update()) update(inputChooser.input()); } |
36 | |
37 | void update(S input) { |
38 | temp enter(); |
39 | bool inputAsFact = cic(inputAs, 'fact); |
40 | NLLogicChecker_v2.staticVerbose = true; |
41 | |
42 | L<IfThen> theRules = ai_parseRulesWithMacros(rules); |
43 | theRules = map nlLogic_rawSentencesToFacts(theRules); |
44 | LS theFacts = tlft(facts); |
45 | |
46 | NLLogicChecker_v2.staticVerbose = true; |
47 | temp tempSetTL(nlLogic_processInputOrFact_allowUnsafeEvals, allowUnsafeEvals); |
48 | setData(nlLogic_processInputOrFact(input, inputAsFact, pair(theRules, theFacts))); |
49 | } |
50 | } |
Began life as a copy of #1018272
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018302 |
Snippet name: | Logic Tester [with direct input of rules & facts, Dyn Module] |
Eternal ID of this version: | #1018302/17 |
Text MD5: | 57ef9c332c6816cfdc9ccf9fe0c26981 |
Transpilation MD5: | e1148ad0135e23bd0aada770bf80a59f |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-02-10 21:32:43 |
Source code size: | 1654 bytes / 50 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 390 / 1104 |
Version history: | 16 change(s) |
Referenced in: | [show references] |