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

!752

sS data = [=[
  [[house] is a noun_clause]
  [if [[X] is a noun_clause] then [[my X] is a noun_clause]]
  [[my house] is a noun_clause]
]=];

p {
  // make Prolog interpreter
  new Prolog p;
  p.upperCaseVariables = true;
  //p.showStuff = true;
  p.addTheory(dropLastLine(rtrim(data)), programID());
  Lisp pivot = nlParse(lastLine(rtrim(data)));
  
  // derive third rule from first two
  L<Lisp> l = p.rewrite(100);
  print("Found " + nl(l, "statement") + ":");
  //printIndent(snlAllToText(l));
  printIndent(nlUnparseLines(l));
  print();
  print("Pivot statement: " + nlUnparse(pivot));
  int idx = l.indexOf(pivot);
  print("Pivot statement found? " + 
    (idx >= 0 ? "Yes, at index " + (idx+1) + "/" + l(l) + "." : "No."));
}

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: 581 / 641
Referenced in: #1005186 - Noun Clauses 2 [works]