WIP: Extraction des règles: facile !

This commit is contained in:
Jean Sirmai 2022-01-09 16:05:53 +01:00
parent cf5ff788fa
commit fbb0dfcfb6
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,7 @@ for pre, fill, node in RenderTree(tree):
treestr = u"%s%s" % (pre, node.id) treestr = u"%s%s" % (pre, node.id)
print(treestr.ljust(0)) print(treestr.ljust(0))
print('\ntype: ', type(tree)) print('\ntype: ', type(tree))
print('path: ', tree.path) print('path: ', tree.path)
print('children: ', tree.children) print('children: ', tree.children)
print('descendants[0]: ', tree.descendants[0]) print('descendants[0]: ', tree.descendants[0])
@ -26,7 +26,11 @@ print(len(tree.path), ' < len(tree.path)\n')
for pre, fill, node in RenderTree(tree): for pre, fill, node in RenderTree(tree):
if node.path[len(node.path) - 1].is_leaf: if node.path[len(node.path) - 1].is_leaf:
print('at depth', len(node.path), print('at depth', len(node.path),
'is rule', node.path[len(node.path) - 1].parent_id) 'is rule', node.path[len(node.path) - 1].parent_id,
'whose path (tracked by conditions weights) is:', end=' ')
for i in range(0, len(node.path) - 1):
print(node.path[i].weight, ',', end='')
print(' transition', node.path[len(node.path) - 1].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.')