!include once #1027630 // Msg cmodule NewEngineSpike > DynPrintLog { L msgs; transient new NewEngine engine; start-thread { if (empty(msgs)) setField(msgs := mainCruddieLog()); print("Have " + nMessages(msgs)); pnlStruct(takeFirst(2, msgs)); L msgs2 = whereFieldIsTrue fromUser(msgs); Msg wrongMsg = get(msgs2, 5); for (Msg msg : takeFirst(5, msgs2)) engine.addFormattedFact("* was understood correctly", msg); engine.addFormattedFact("* is a wrong recognition", wrongMsg); engine.addLogicRule(new BasicLogicRule( ll(SymVar("$x"), Fragment("is a wrong recognition")), ll(SymVar("$x"), Fragment("should be corrected")))); engine.addLogicRule(new BasicLogicRule( ll("$x", Fragment("should be corrected")), ll("$x", Fragment("is a wrong recognition")))); engine.think(); L facts = engine.factsInOrderOfDefinition(); assertContains(facts, formatWithFragments("* should be corrected", wrongMsg)); assertDoesntContain(facts, formatWithFragments("* should be corrected", first(msgs2))); print("OK"); } }