Ejemplo n.º 1
0
 def build_from_file(filename: str):
     rules = []
     with open(filename) as rule_file:
         data = json.load(rule_file)
         raw_rules = data["ruleset"]
         if "probabilistic" in data:
             probabilistic = data["probabilistic"]
         else:
             probabilistic = False
         for raw_rule in raw_rules:
             rules.append(Rule.build_from_json(json_data=raw_rule))
         if "bottype" in data:
             bottype = data["bottype"]
         else:
             bottype = None
     return Globot(rules=rules,
                   probabilistic=probabilistic,
                   bottype=bottype)