def run_from_command_line(): logging.basicConfig(level=logging.INFO, format='%(message)s') try: relation_name = iepy.instance.rules.RELATION except AttributeError: logging.error("RELATION not defined in rules file") sys.exit(1) try: relation = models.Relation.objects.get(name=relation_name) except ObjectDoesNotExist: logging.error("Relation {!r} not found".format(relation_name)) sys.exit(1) # Load rules rules = load_rules() # Load evidences evidences = CandidateEvidenceManager.candidates_for_relation(relation) # Run the pipeline iextractor = RuleBasedCore(relation, evidences, rules) iextractor.start() iextractor.process() predictions = iextractor.predict() output.dump_output_loop(predictions)
def run_from_command_line(): logging.basicConfig(level=logging.INFO, format='%(message)s') try: relation_name = iepy.instance.rules.RELATION except AttributeError: logging.error("RELATION not defined in rules file") sys.exit(1) try: relation = models.Relation.objects.get(name=relation_name) except ObjectDoesNotExist: logging.error("Relation {!r} not found".format(relation_name)) sys.exit(1) # Load rules rules = load_rules() # Load evidences evidences = CandidateEvidenceManager.candidates_for_relation(relation) # Run the pipeline iextractor = RuleBasedCore(relation, rules) iextractor.start() iextractor.process() predictions = iextractor.predict(evidences) output.dump_output_loop(predictions)
def get_rules(rule_name): # Load rules rules = load_rules() if rule_name: rules = [x for x in rules if x.__name__ == rule_name] if not rules: logging.error("rule '{}' does not exists".format(rule_name)) sys.exit(1) return rules