Guest User

Untitled

a guest
Jun 25th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. from logic import *
  2.  
  3. a = AtomSpace()
  4.  
  5. t = types
  6.  
  7. socrates = a.add_node(t.ConceptNode, "Socrates")
  8. socrates.tv = TruthValue(.01, .3)
  9. print socrates
  10. print socrates.tv
  11.  
  12. man = a.add_node(t.ConceptNode, "man")
  13. man.tv = TruthValue(.01, .3)
  14. print man
  15. print man.tv
  16.  
  17. mortal = a.add_node(t.ConceptNode, "mortal")
  18. mortal.tv = TruthValue(.1, .8)
  19. print mortal
  20. print mortal.tv
  21.  
  22. A = a.add_link(t.InheritanceLink, [socrates, man])
  23. B = a.add_link(t.InheritanceLink, [man, mortal])
  24.  
  25. A.tv = TruthValue(.7, .3)
  26. B.tv = TruthValue(.8, .2)
  27.  
  28. print A
  29. print B
  30. print A.tv
  31. print B.tv
  32.  
  33.  
  34. #log.use_stdout(True)
  35. #atom_from_tree(Tree('EvaluationLink',a.add_node(t.PredicateNode,'A')), a).tv = TruthValue(1, 1)
  36. thingie1 = atom_from_tree(Tree('InheritanceLink',socrates,man), a).tv = TruthValue(.4, .5)
  37. thingie2 = atom_from_tree(Tree('InheritanceLink',man,mortal), a).tv = TruthValue(.5, .5)
  38. thingie3 = atom_from_tree(Tree('InheritanceLink',socrates,mortal), a)
  39.  
  40. print thingie1
  41. print thingie2
  42.  
  43. c = Chainer(a)
  44. c.bc(Tree('InheritanceLink',socrates, mortal))
  45.  
  46. print Tree('InheritanceLink',socrates, mortal)
Add Comment
Please, Sign In to add comment