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

73
LINES

< > BotCompany Repo | #1008133 // MyTruth (include)

JavaX fragment (include)

sbool myTruth_verbose, myTruth_persistent = true;

svoid loadMyTruthFrom(S dbProgramID) {
  loadConceptsFrom(dbProgramID);
  loadMyTruth2();
}

svoid loadMyTruth {
  if (myTruth_persistent) db();
  loadMyTruth2();
}

svoid loadMyTruth2 {
  tt();
  set englishToConceptLanguage_hygienicParsing;
  for (MyTruth t)
    lispAddLocalTruth(t.globalID, t.term);
}

svoid myTruth(S bla) {
  Pair<S> p = splitConceptsFromStatements(bla);
  myTruth(p.a, p.b);
}

svoid myTruth(S concepts, S statements) {
  useConceptsAndStatements(concepts, statements);
  loadMyTruth();
  aiStandardHandlers();
  printLispStatements();
}

svoid fromUser(S head, O... args) { fromUser(lisp(head, args)); }
svoid fromUser(Lisp l) { emit(l, "user"); }

svoid emit(Lisp l) { emit(l, ""); }
svoid emit(Lisp l, S madeByRule) {
  ThoughtSpace ts = thoughtSpace();
  if (ts != null) {
    ts.addStatement(l);
    ret;
  }
  LispStatement s = lispAddLocalTruth(l);
  if (s != null) {
    new MyTruth(s.globalID, l, madeByRule);
    if (myTruth_verbose)
      print("emit> " + l);
  }
}

svoid unemit(Lisp l) {
  ThoughtSpace ts = thoughtSpace();
  if (ts != null) {
    //print("Unemitting from " + ts.globalID + ": " + l);
    ts.removeStatement(l);
    ret;
  }
  LispStatement s = findLispStatement(l);
  if (s == null) ret;
  removeLispStatement(s);
  deleteConcepts(MyTruth, globalID := s.globalID);
}

svoid unemit(S statementID) {
  ThoughtSpace ts = thoughtSpace();
  if (ts != null) {
    ts.removeStatement(statementID);
    ret;
  }
  LispStatement s = getLispStatement(statementID);
  if (s == null) ret;
  removeLispStatement(s);
  deleteConcepts(MyTruth, globalID := s.globalID);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1008133
Snippet name: MyTruth (include)
Eternal ID of this version: #1008133/20
Text MD5: ef86ae1634c904d0faf30763ad9d0d4d
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-24 23:18:22
Source code size: 1735 bytes / 73 lines
Pitched / IR pitched: No / No
Views / Downloads: 556 / 1100
Version history: 19 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1008122 - Compare Bot 3 [shortened]
#1008131 - Compare Bot 4 [full rule application, dev.]
#1008153 - Parse Sentences [dev.]
#1008293 - myTruthNonPersist