Uses 911K of libraries. Click here for Pure Java version (5821L/29K).
1 | !include once #1027630 // Msg |
2 | |
3 | cmodule NewEngineSpike > DynPrintLog { |
4 | L<Msg> msgs; |
5 | transient new NewEngine engine; |
6 | |
7 | start-thread { |
8 | if (empty(msgs)) |
9 | setField(msgs := mainCruddieLog()); |
10 | print("Have " + nMessages(msgs)); |
11 | pnlStruct(takeFirst(2, msgs)); |
12 | L<Msg> msgs2 = whereFieldIsTrue fromUser(msgs); |
13 | Msg wrongMsg = get(msgs2, 5); |
14 | for (Msg msg : takeFirst(5, msgs2)) |
15 | engine.addFormattedFact("* was understood correctly", msg); |
16 | engine.addFormattedFact("* is a wrong recognition", wrongMsg); |
17 | |
18 | engine.addLogicRule(new BasicLogicRule( |
19 | ll(SymVar("$x"), Fragment("is a wrong recognition")), |
20 | ll(SymVar("$x"), Fragment("should be corrected")))); |
21 | engine.addLogicRule(new BasicLogicRule( |
22 | ll("$x", Fragment("should be corrected")), |
23 | ll("$x", Fragment("is a wrong recognition")))); |
24 | |
25 | engine.think(); |
26 | |
27 | L facts = engine.factsInOrderOfDefinition(); |
28 | assertContains(facts, formatWithFragments("* should be corrected", wrongMsg)); |
29 | assertDoesntContain(facts, formatWithFragments("* should be corrected", first(msgs2))); |
30 | print("OK"); |
31 | } |
32 | } |
Began life as a copy of #1027758
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027763 |
Snippet name: | Test NewEngine [OK] |
Eternal ID of this version: | #1027763/8 |
Text MD5: | 0b42d962e6d60fb2128684f67938471d |
Transpilation MD5: | 3f18ac47159dd3de2ad36f2edc0f1100 |
Author: | stefan |
Category: | javax / new gazelle |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-04-16 14:15:46 |
Source code size: | 1146 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 243 / 903 |
Version history: | 7 change(s) |
Referenced in: | [show references] |