WIP: Extraction des règles: première approche.

This commit is contained in:
Jean Sirmai 2022-01-09 15:45:51 +01:00
parent 648072f59d
commit cf5ff788fa
Signed by: jean
GPG Key ID: FB3115C340E057E3
5 changed files with 14 additions and 9 deletions

Binary file not shown.

View File

@ -378,7 +378,7 @@ class Transition:
def get_author(self): def get_author(self):
return self.node.attrib["author"] return self.node.attrib["author"]
def get_parent(self): def get_parent_id(self):
return self.node.attrib["parent"] return self.node.attrib["parent"]
def get_probability(self): def get_probability(self):

View File

@ -46,7 +46,7 @@ for i in range(0, len(model.testmodel.get_transitions().get_all())):
transition = model.testmodel.get_transitions().get_one(i) transition = model.testmodel.get_transitions().get_one(i)
transitions_set.add(TreeNode( transitions_set.add(TreeNode(
transition.get_id(), transition.get_id(),
transition.get_parent(), transition.get_parent_id(),
None, None, None, None, None)) None, None, None, None, None))
for i in conditions_set: for i in conditions_set:

View File

@ -4,7 +4,14 @@ import rules_tree
tree = rules_tree.get_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.depth, ' < depth')
print(tree.is_leaf, ' < is_leaf') print(tree.is_leaf, ' < is_leaf')
print(tree.is_root, ' < is_root') print(tree.is_root, ' < is_root')
@ -14,14 +21,12 @@ print(tree.ancestors, ' < ancestors')
print(tree.anchestors, ' < anchestors') print(tree.anchestors, ' < anchestors')
print(tree.siblings, ' < siblings') print(tree.siblings, ' < siblings')
print(len(tree.leaves), ' < len(tree.leaves)') print(len(tree.leaves), ' < len(tree.leaves)')
print(len(tree.path), ' < len(tree.path)') print(len(tree.path), ' < len(tree.path)\n')
print('path: ', tree.path)
print('children: ', tree.children)
print('descendants[0]: ', tree.descendants[0])
for pre, fill, node in RenderTree(tree): for pre, fill, node in RenderTree(tree):
treestr = u"%s%s" % (pre, node.id) if node.path[len(node.path) - 1].is_leaf:
print(treestr.ljust(46)) print('at depth', len(node.path),
'is rule', node.path[len(node.path) - 1].parent_id)
print('\nNext step: single rule extraction from tree.', print('\nNext step: single rule extraction from tree.',
' 😃️\nand learn how to use the Newick format.') ' 😃️\nand learn how to use the Newick format.')