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

73
LINES

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

JavaX fragment (include)

1  
sbool myTruth_verbose, myTruth_persistent = true;
2  
3  
svoid loadMyTruthFrom(S dbProgramID) {
4  
  loadConceptsFrom(dbProgramID);
5  
  loadMyTruth2();
6  
}
7  
8  
svoid loadMyTruth {
9  
  if (myTruth_persistent) db();
10  
  loadMyTruth2();
11  
}
12  
13  
svoid loadMyTruth2 {
14  
  tt();
15  
  set englishToConceptLanguage_hygienicParsing;
16  
  for (MyTruth t)
17  
    lispAddLocalTruth(t.globalID, t.term);
18  
}
19  
20  
svoid myTruth(S bla) {
21  
  Pair<S> p = splitConceptsFromStatements(bla);
22  
  myTruth(p.a, p.b);
23  
}
24  
25  
svoid myTruth(S concepts, S statements) {
26  
  useConceptsAndStatements(concepts, statements);
27  
  loadMyTruth();
28  
  aiStandardHandlers();
29  
  printLispStatements();
30  
}
31  
32  
svoid fromUser(S head, O... args) { fromUser(lisp(head, args)); }
33  
svoid fromUser(Lisp l) { emit(l, "user"); }
34  
35  
svoid emit(Lisp l) { emit(l, ""); }
36  
svoid emit(Lisp l, S madeByRule) {
37  
  ThoughtSpace ts = thoughtSpace();
38  
  if (ts != null) {
39  
    ts.addStatement(l);
40  
    ret;
41  
  }
42  
  LispStatement s = lispAddLocalTruth(l);
43  
  if (s != null) {
44  
    new MyTruth(s.globalID, l, madeByRule);
45  
    if (myTruth_verbose)
46  
      print("emit> " + l);
47  
  }
48  
}
49  
50  
svoid unemit(Lisp l) {
51  
  ThoughtSpace ts = thoughtSpace();
52  
  if (ts != null) {
53  
    //print("Unemitting from " + ts.globalID + ": " + l);
54  
    ts.removeStatement(l);
55  
    ret;
56  
  }
57  
  LispStatement s = findLispStatement(l);
58  
  if (s == null) ret;
59  
  removeLispStatement(s);
60  
  deleteConcepts(MyTruth, globalID := s.globalID);
61  
}
62  
63  
svoid unemit(S statementID) {
64  
  ThoughtSpace ts = thoughtSpace();
65  
  if (ts != null) {
66  
    ts.removeStatement(statementID);
67  
    ret;
68  
  }
69  
  LispStatement s = getLispStatement(statementID);
70  
  if (s == null) ret;
71  
  removeLispStatement(s);
72  
  deleteConcepts(MyTruth, globalID := s.globalID);
73  
}

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: 557 / 1101
Version history: 19 change(s)
Referenced in: [show references]