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

27
LINES

< > BotCompany Repo | #1005180 // Noun Clauses [dev.]

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

Libraryless. Click here for Pure Java version (6917L/45K/144K).

1  
!752
2  
3  
sS data = [=[
4  
  [[house] is a noun_clause]
5  
  [if [[X] is a noun_clause] then [[my X] is a noun_clause]]
6  
  [[my house] is a noun_clause]
7  
]=];
8  
9  
p {
10  
  // make Prolog interpreter
11  
  new Prolog p;
12  
  p.upperCaseVariables = true;
13  
  //p.showStuff = true;
14  
  p.addTheory(dropLastLine(rtrim(data)), programID());
15  
  Lisp pivot = nlParse(lastLine(rtrim(data)));
16  
  
17  
  // derive third rule from first two
18  
  L<Lisp> l = p.rewrite(100);
19  
  print("Found " + nl(l, "statement") + ":");
20  
  //printIndent(snlAllToText(l));
21  
  printIndent(nlUnparseLines(l));
22  
  print();
23  
  print("Pivot statement: " + nlUnparse(pivot));
24  
  int idx = l.indexOf(pivot);
25  
  print("Pivot statement found? " + 
26  
    (idx >= 0 ? "Yes, at index " + (idx+1) + "/" + l(l) + "." : "No."));
27  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005180
Snippet name: Noun Clauses [dev.]
Eternal ID of this version: #1005180/1
Text MD5: 82d5fef035bb8f95ef3473affb16f567
Transpilation MD5: 316cfa3eafc9c9174dcb467ce3cb00e0
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-10-19 15:44:50
Source code size: 766 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 582 / 643
Referenced in: [show references]