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).

1  
!7
2  
3  
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")])]];
4  
5  
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")])]];
6  
7  
p-subst {
8  
  // Prepare
9  
  
10  
  CALSpringLayout.defaultDesiredLength = 0.45;
11  
  Web web = webFromCALStructures(inputDiagram1, inputDiagram2);
12  
  webToCAL_visStructures(inputDiagram1, inputDiagram2);
13  
  
14  
  // Reason
15  
  
16  
  web_upper(web);
17  
  web_isA_expandForward(web);
18  
  web_mergeNodesByFirstLabel(web);
19  
  Web web2 = cloneWeb(web);
20  
  web_collapseBackwards(web2, "is");
21  
  web_addLabelToLabelTop(web2, "a human", "who?");
22  
  
23  
  // Find node in question & one reference node
24  
  
25  
  WebNode questionNode = first(web_nodesEndingWith(web2, "?"));
26  
  WebNode reference = web_findBackwardRelated(questionNode);
27  
  web_dropAllNodesBut(questionNode, reference);
28  
  
29  
  // Make question
30  
  
31  
  S question =
32  
    "Please tell me " + dropSuffix("?", questionNode.text())
33  
      + " " + reference.text() + " " + web2.getRelation(reference, questionNode).text() + ".";
34  
      
35  
  // Show
36  
37  
  centerFrame(setFrameSize(800, 600, showTabbedWebs(0,
38  
    "User Input 1", webFromCALStructure(inputDiagram1),
39  
    "User Input 2", webFromCALStructure(inputDiagram2),
40  
    "Temporary Web", web,
41  
    "Final Web", web2,
42  
    "Generated Question", setFontSize(20, jcenteredlabel(question)))));
43  
  infoBox("Generated question:\n\n" + question);
44  
  hideConsole();
45  
}

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: 663 / 1589
Version history: 27 change(s)
Referenced in: [show references]