diff --git a/src/__pycache__/model.cpython-39.pyc b/src/__pycache__/model.cpython-39.pyc index d4dd930..0017058 100644 Binary files a/src/__pycache__/model.cpython-39.pyc and b/src/__pycache__/model.cpython-39.pyc differ diff --git a/src/__pycache__/rules_tree.cpython-39.pyc b/src/__pycache__/rules_tree.cpython-39.pyc index bfa24f8..73566a2 100644 Binary files a/src/__pycache__/rules_tree.cpython-39.pyc and b/src/__pycache__/rules_tree.cpython-39.pyc differ diff --git a/src/model.py b/src/model.py index e3986b7..28cf28d 100644 --- a/src/model.py +++ b/src/model.py @@ -378,7 +378,7 @@ class Transition: def get_author(self): return self.node.attrib["author"] - def get_parent(self): + def get_parent_id(self): return self.node.attrib["parent"] def get_probability(self): diff --git a/src/rules_tree.py b/src/rules_tree.py index c4b82fa..691e921 100644 --- a/src/rules_tree.py +++ b/src/rules_tree.py @@ -46,7 +46,7 @@ for i in range(0, len(model.testmodel.get_transitions().get_all())): transition = model.testmodel.get_transitions().get_one(i) transitions_set.add(TreeNode( transition.get_id(), - transition.get_parent(), + transition.get_parent_id(), None, None, None, None, None)) for i in conditions_set: diff --git a/src/show_tree.py b/src/show_tree.py index adc14e1..f17d5d7 100644 --- a/src/show_tree.py +++ b/src/show_tree.py @@ -4,7 +4,14 @@ import rules_tree tree = rules_tree.get_tree() -print('type: ', type(tree)) +for pre, fill, node in RenderTree(tree): + treestr = u"%s%s" % (pre, node.id) + print(treestr.ljust(0)) + +print('\ntype: ', type(tree)) +print('path: ', tree.path) +print('children: ', tree.children) +print('descendants[0]: ', tree.descendants[0]) print(tree.depth, ' < depth') print(tree.is_leaf, ' < is_leaf') print(tree.is_root, ' < is_root') @@ -14,14 +21,12 @@ print(tree.ancestors, ' < ancestors') print(tree.anchestors, ' < anchestors') print(tree.siblings, ' < siblings') print(len(tree.leaves), ' < len(tree.leaves)') -print(len(tree.path), ' < len(tree.path)') -print('path: ', tree.path) -print('children: ', tree.children) -print('descendants[0]: ', tree.descendants[0]) +print(len(tree.path), ' < len(tree.path)\n') for pre, fill, node in RenderTree(tree): - treestr = u"%s%s" % (pre, node.id) - print(treestr.ljust(46)) + if node.path[len(node.path) - 1].is_leaf: + print('at depth', len(node.path), + 'is rule', node.path[len(node.path) - 1].parent_id) print('\nNext step: single rule extraction from tree.', ' 😃️\nand learn how to use the Newick format.')