Examples

These and more examples files are included in the examples/ directory of the source repository/distribution.

digits.cxt

 1B
 2
 310
 47
 5
 60
 71
 82
 93
104
115
126
137
148
159
16a
17b
18c
19d
20e
21f
22g
23X.XXXXX
24.....XX
25XXX.XX.
26XXX..XX
27.X.X.XX
28XXXX..X
29.XXXX.X
30X....XX
31XXXXXXX
32XX.X.XX
import concepts

digits = concepts.Context.fromfile('examples/digits.cxt')

digits.lattice.graphviz(view=True)
_images/digits.svg

relations.csv

 1name,relation,transitive,symmetric,antisymmetric,reflexive,irreflexive,asymmetric,neg. trans.,connected,total,trichotomous
 2irrefl.,X,,,,,X,,,,,
 3tolerance,X,,X,,X,,,,,,
 4equivalence,X,X,X,,X,,,,,,
 5preorder,X,X,,,X,,,,,,
 6partial order,X,X,,X,X,,,,,,
 7total order,X,X,,X,X,,,X,X,X,
 8strict partial order,X,X,,X,,X,X,,,,
 9strict weak order,X,X,,X,,X,X,X,,,
10strict total order,X,X,,X,,X,X,X,X,,X
11R = X = {},X,X,X,X,X,X,X,X,X,X,X
import concepts

relations = concepts.Context.fromfile('examples/relations.csv', frmat='csv')

relations.lattice.graphviz(view=True)
_images/relations.svg

example.json

1{"context": [[0, 3, 5, 6, 9], [0, 3, 5, 7, 8], [1, 2, 5, 6, 9], [1, 2, 5, 7, 8], [1, 3, 4, 6, 9], [1, 3, 4, 7, 8]], "lattice": [[[], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 5, 6], []], [[0], [0, 3, 5, 6, 9], [7, 8, 9], [0]], [[1], [0, 3, 5, 7, 8], [7, 10, 11], [0]], [[2], [1, 2, 5, 6, 9], [8, 12, 13], [0]], [[3], [1, 2, 5, 7, 8], [10, 12, 14], [0]], [[4], [1, 3, 4, 6, 9], [9, 13, 15], [0]], [[5], [1, 3, 4, 7, 8], [11, 14, 15], [0]], [[0, 1], [0, 3, 5], [18, 19], [1, 2]], [[0, 2], [5, 6, 9], [16, 18], [1, 3]], [[0, 4], [3, 6, 9], [16, 19], [1, 5]], [[1, 3], [5, 7, 8], [17, 18], [2, 4]], [[1, 5], [3, 7, 8], [17, 19], [2, 6]], [[2, 3], [1, 2, 5], [18, 20], [3, 4]], [[2, 4], [1, 6, 9], [16, 20], [3, 5]], [[3, 5], [1, 7, 8], [17, 20], [4, 6]], [[4, 5], [1, 3, 4], [19, 20], [5, 6]], [[0, 2, 4], [6, 9], [21], [8, 9, 13]], [[1, 3, 5], [7, 8], [21], [10, 11, 14]], [[0, 1, 2, 3], [5], [21], [7, 8, 10, 12]], [[0, 1, 4, 5], [3], [21], [7, 9, 11, 15]], [[2, 3, 4, 5], [1], [21], [12, 13, 14, 15]], [[0, 1, 2, 3, 4, 5], [], [], [18, 19, 20, 16, 17]]], "objects": ["1sg", "1pl", "2sg", "2pl", "3sg", "3pl"], "properties": ["+1", "-1", "+2", "-2", "+3", "-3", "+sg", "+pl", "-sg", "-pl"]}
import concepts

example = concepts.Context.fromjson('examples/example.json', require_lattice=True)

example.lattice.graphviz(view=True)
_images/example.svg