Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

45
LINES

< > BotCompany Repo | #1010105 // Think about project / Demo for Linas [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 4489K of libraries. Click here for Pure Java version (14704L/106K).

!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();
}

Author comment

Began life as a copy of #1010048

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, imzmzdywqqli, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1010105
Snippet name: Think about project / Demo for Linas [OK]
Eternal ID of this version: #1010105/28
Text MD5: 9a241999d1e550fa7e405547b7390d08
Transpilation MD5: 3a3f9b34ee34b12290c9bc3f0299f841
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-03 02:26:23
Source code size: 1921 bytes / 45 lines
Pitched / IR pitched: No / No
Views / Downloads: 553 / 1307
Version history: 27 change(s)
Referenced in: [show references]