In [1]:
from symbolic import Symbolic, Reason
In [2]:
s1 = Symbolic('a')
print (s1)
s1.add_symbolic('a', 'foo')
print (s1)
print (len(s1), type(s1))
In [3]:
s1 = Symbolic('0 1 1')
s2 = Symbolic('1 0 1')
s1.mask(s2)
Out[3]:
In [4]:
s1 = Symbolic('a b c')
s2 = Symbolic('x y c')
s3 = Symbolic('c o i')
print (s1.mask(s2))
print (s2.mask(s3))
In [5]:
r = Reason()
s1 = Symbolic('0 1 0')
r.add_pattern(pattern=s1, attribute='middle', relation='is')
s2 = Symbolic('0 1 1')
r.add_pattern(pattern=s2, attribute='middle', relation='is')
s3 = Symbolic('1 1 1')
r.add_pattern(pattern=s3, attribute='middle', relation='is')
r.add_pattern(pattern=Symbolic('0 0 1'), attribute='middle', relation='is not')
r.add_pattern(pattern=Symbolic('1 0 0'), attribute='middle', relation='is not')
r.get_patterns('middle')['patterns']
Out[5]:
In [6]:
r.distinguishing('middle')
Out[6]:
In [7]:
s0 = Symbolic('1 1 0')
print (r.determine(s0, 'middle'))
s0 = Symbolic('1 0 0')
print (r.determine(s0, 'middle'))
s0 = Symbolic('0 0 0')
print (r.determine(s0, 'middle'))
In [8]:
s0 = Symbolic('x y z')
r.determine(s0, 'middle')
Out[8]:
In [16]:
r = Reason()
s1 = Symbolic('a b c o u t z')
r.add_pattern(pattern=s1, attribute='abc', relation='is')
s2 = Symbolic('v a b c h v l')
r.add_pattern(pattern=s2, attribute='abc', relation='is')
s3 = Symbolic('x y k a b n')
r.add_pattern(pattern=s3, attribute='abc', relation='is not')
s4 = Symbolic('o n o x y g')
r.add_pattern(pattern=s4, attribute='abc', relation='is not')
print (r.distinguishing('abc'))
print (r.distinguishing('abc', relation='is not'))
In [17]:
s0 = Symbolic('c b a c a n x')
r.determine(s0, 'abc', debug=False)
Out[17]:
In [18]:
s0 = Symbolic('c b a c b a n x')
r.add_pattern(pattern=s0, attribute='abc', relation='is not')
print (r.distinguishing('abc', relation='is not'))
In [19]:
s0 = Symbolic('o g h j n x')
r.determine(s0, 'abc')
Out[19]:
In [20]:
s1 = Symbolic('terrier trout crow')
s1.add_symbolic('terrier', 'dog')
s1.add_symbolic('trout', 'fish')
s1.add_symbolic('crow', 'bird')
s2 = Symbolic('robin')
s2.add_symbolic('robin', 'bird')
s1.mask(s2)
Out[20]: