forked from singnet/atomspace
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_atoms_simple.py
More file actions
executable file
·34 lines (26 loc) · 872 Bytes
/
create_atoms_simple.py
File metadata and controls
executable file
·34 lines (26 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /usr/bin/env python
#
# create_atoms_simple.py
#
"""
A simple way of creating atoms in the AtomSpace.
See also create_stoms_by_type.py for an alternate API for atoms.
"""
from opencog.atomspace import AtomSpace, TruthValue
from opencog.atomspace import types
from opencog.type_constructors import *
a = AtomSpace()
# Tell the type constructors which atomspace to use.
set_type_ctor_atomspace(a)
# Create a truth value asserting true and mostly confident.
TV = TruthValue(1, 0.8)
# Add three nodes
A = ConceptNode('Apple', TV)
B = ConceptNode('Berry', TruthValue(0.5, 0.75))
C = ConceptNode('Comestible', TV)
# Add three inhertance links, asserting that apples are berries
# and that berries are edible.
AB = InheritanceLink(A, B, TV)
BC = InheritanceLink(B, C, TV)
AC = InheritanceLink(A, C)
print "The atomspace contains:\n\n", a.get_atoms_by_type(types.Atom)