Skip to content

Commit

Permalink
[fixed]: build an incorrect root set of the classfication tree.
Browse files Browse the repository at this point in the history
  • Loading branch information
zake7749 committed Aug 21, 2016
1 parent 545109e commit 11666e7
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 334 deletions.
Binary file modified RuleMatcher/__pycache__/rulebase.cpython-35.pyc
Binary file not shown.
9 changes: 8 additions & 1 deletion RuleMatcher/rulebase.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,21 @@ def load_rules(self, path, reload=False):
self.rules[domain] = rule
else:
print("[Rules]: Detect a duplicate domain name '%s'." % domain)
self.build_forest_root()

# build the base root list (the root has no parent.)
def build_forest_root(self):

self.forest_base_roots = []
"""
build the base root list (the root has no parent.)
"""
children_set = set()
for rule in self.rules.values():
for child in rule.children:
children_set.add(child)
for rule in self.rules.values():
if rule.id_term not in children_set:
print(rule.id_term)
self.forest_base_roots.append(self.rules[rule.id_term])

def load_rules_from_dic(self,path):
Expand Down
Loading

0 comments on commit 11666e7

Please sign in to comment.