!7 sS inputDiagram1 = [[CirclesAndLines(circles=[Circle(quickvis="OpenCog", text="OpenCog", x=d("0.23198847262247838"), y=d("0.3694390715667311")), Circle(text="Project", x=d("0.6628242074927954"), y=d("0.21470019342359767")), Circle(quickvis="AI", text="AI", x=d("0.7146974063400576"), y=d("0.6673114119922631"))], lines=[Arrow(a=t5, b=t30, text="is a"), Arrow(a=t30, b=t51, text="for")])]]; sS inputDiagram2 = [[CirclesAndLines(circles=[Circle(text="A project", x=d("0.2968299711815562"), y=d("0.35589941972920697")), Circle(quickvis="a human", text="a human", x=d("0.7219020172910663"), y=d("0.3578336557059961"))], lines=[Arrow(a=t5, b=t26, text="is led by")])]]; p-subst { // Prepare CALSpringLayout.defaultDesiredLength = 0.45; Web web = webFromCALStructures(inputDiagram1, inputDiagram2); webToCAL_visStructures(inputDiagram1, inputDiagram2); // Reason web_upper(web); web_isA_expandForward(web); web_mergeNodesByFirstLabel(web); Web web2 = cloneWeb(web); web_collapseBackwards(web2, "is"); web_addLabelToLabelTop(web2, "a human", "who?"); // Find node in question & one reference node WebNode questionNode = first(web_nodesEndingWith(web2, "?")); WebNode reference = web_findBackwardRelated(questionNode); web_dropAllNodesBut(questionNode, reference); // Make question S question = "Please tell me " + dropSuffix("?", questionNode.text()) + " " + reference.text() + " " + web2.getRelation(reference, questionNode).text() + "."; // Show centerFrame(setFrameSize(800, 600, showTabbedWebs(0, "User Input 1", webFromCALStructure(inputDiagram1), "User Input 2", webFromCALStructure(inputDiagram2), "Temporary Web", web, "Final Web", web2, "Generated Question", setFontSize(20, jcenteredlabel(question))))); infoBox("Generated question:\n\n" + question); hideConsole(); }