!7 concept Example { S text; bool pos; } concept Theory { S pattern; Cl solvedExamples; } cmodule PatternMaker { switchable S caseID = aGlobalID(); S examplesText, counterexamplesText; transient JTable theoriesTable; transient Concepts concepts; start { cc = dm_handleCaseIDField(); indexConceptField(cc, Example, 'text); indexConceptFieldCI(cc, Theory, 'pattern); } 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())), jCenteredSection("Theories", theoriesTable = sexyTable())), jThreadedButton("Think", rEnter think)); void think { 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) uniq(cc, Example(, s, true)), map(l2, s -> new Example(s, false)))); setField(theories := ai_inputExampleToPossibleMMOPatterns1()); dataToTable_uneditable_ifHasTable(theoriesTable, map( } }