From cf5ff788fa195cc28a196e247af3b09fe2432728 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Sun, 9 Jan 2022 15:45:51 +0100 Subject: [PATCH] =?UTF-8?q?WIP:=20Extraction=20des=20r=C3=A8gles:=20premi?= =?UTF-8?q?=C3=A8re=20approche.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/__pycache__/model.cpython-39.pyc | Bin 19477 -> 19473 bytes src/__pycache__/rules_tree.cpython-39.pyc | Bin 1659 -> 1647 bytes src/model.py | 2 +- src/rules_tree.py | 2 +- src/show_tree.py | 19 ++++++++++++------- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/__pycache__/model.cpython-39.pyc b/src/__pycache__/model.cpython-39.pyc index d4dd9304d428f0f87453132ebc8152edfb25ed43..0017058e6b308c21b72bfd34a8fd9c80e7ab9253 100644 GIT binary patch delta 294 zcmbO_gK^>vM&3kTUM>b8@PB(Nk!vGwsg+vMLLj%6k%6I@2_(T-B@t4Tm{*)xl9`{U zm!4V@UyxXonm4(DS#)xOFz;k}1)j;btbVhBbQP`MeA{{gBjdWsvYHZ;TWtLp*H3=P zB0l+*tp!l5*<4+G4Nz4($ZQTEgM*QUiGz)UxoFMiM7wfU#*LeAI$vO9+&X!c>leoD zK%Ekkx4R`W?f|n4-BTHNf?4a`;~95>SsT@th7+BIA|7y%i+b1|s%OZt_xMJU01&gaqS;$%nm^f#h?q)!blh1t1k0CeQV* F004}wVXOcE delta 283 zcmbO@gK_E%M&3kTUM>b8_<8nbBKt<(Qme`9)!5hz5{pvvN@^!dT1m4(*pnF*v?gD( z`pvx>sJLhih$xwSKtf{k7wck1#`TkBH6q*6{FW+zRB$PM+!!!ng-4&g7ZE2C}VaFPPil yIUT4(!YhGo8%VHia$`I8epCP diff --git a/src/__pycache__/rules_tree.cpython-39.pyc b/src/__pycache__/rules_tree.cpython-39.pyc index bfa24f8b10b7aeabd9795bdc33d95b3e181cfe99..73566a202f102e7d83acbacb73fc42ed02ec42b1 100644 GIT binary patch delta 172 zcmey(^PYz{k(ZZ?0SGwX-AWYS$jidWC^T7!QMq0wl`mB$n>m#)OCnV!OE#Oyfnfq; z5lbrH0=ZO~g^Y|qULi~2pH!w)j%G#|hFG&G`BeEV1)v(URCXX=DM~R_2`D1l%$TZ} zC6UbplyOT{1nQQD>UIN~V3xv`!rsCVrJTYP%%I8f666w1rdynTo3}9XFf*!bKFGqv JIQcy58USd0D|!F` delta 185 zcmaFQ^P7h^k(ZZ?0SJUo-%1qO$jidWC^K1zQMq0=l`mB`n>m#)OCnV^OD>zqfnfq; z5lbrH0{K+gg^Y|qULi~2pH!w)j%G#|hFG⋙a$sMW7n9RCXX=DM~3-87Lyx%$TZ_ zC6UbplyOT{0_s+P>UIN~V3xv`!rsCVrINxF%%I8f666w1rdynTo3}9XFf*!dKFGqv W$P>kto>~%LkXV$OS2Fo9>ly&7)G!DD 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.')