!7 concept Example { S text; bool pos; } concept Theory { S pattern; Cl solvedExamples; transient simplyCached int complexityClass() { ret numberOfWords2(pattern); } } cmodule PatternMaker { switchable bool enabled = true; switchable S caseID = aGlobalID(); S examplesText, counterexamplesText; transient JTable theoriesTable; transient Concepts cc; start { //cc = dm_handleCaseIDField(); cc = new Concepts; indexConceptFieldCI(cc, Example, 'text); indexConceptFieldCI(cc, Theory, 'pattern); if (enabled) thread { think(); } } S _modifyStructForDuplication(S struct) { ret jreplace_first(struct, "caseID=*", "caseID=" + quote(aGlobalID())); } visual withCenteredButtons(jvsplit( jhgrid( jCenteredSection("Examples", dm_textArea examplesText()), jCenteredSection("Counterexamples", dm_textArea counterexamplesText())), jhsplit( jCenteredSection("Theories", theoriesTable = sexyTable()), dm_printLogComponent())), jThreadedButton("Think", rEnter think), dm_checkBox enabled()); void think enter { Set l1 = asLinkedHashSet(tlftj(examplesText)); Set l2 = asLinkedHashSet(tlftj(counterexamplesText)); Set intersection = setIntersection(l1, l2); if (nempty(intersection)) ret with infoBox("Error: Examples appear in both lists, e.g. " + first(intersection)); deleteConcepts(cc, Example); for (S s : l1) uniqCI(cc, Example, text := s, pos := true); for (S s : l2) uniqCI(cc, Example, text := s, pos := false); print("Have " + nExamples(countConcepts(cc, Example))); for (S s : l1) addPatterns(ai_inputExampleToPossibleMMOPatterns1(s)); print("Have " + nTheories(countConcepts(cc, Theory))); //dataToTable_uneditable_ifHasTable(theoriesTable, map...); } void addPatterns(Iterable l) { fOr (S s : l) addPattern(s); } void addPattern(S pattern) { uniqCI(cc, Theory, +pattern); } }