evalfiletext = "".join(evalfilelines) ignore, goldliterals = parse.definite_clauses(parse.parse(evalfiletext)) # Handle parsecheck if args.parsecheck: report = parse.parsecheck(obs, kb) print(report, file=args.outfile) sys.exit() # Handle forward if args.forward: entailed = forward.forward(obs, kb) if args.graph: print(forward.graph(obs, entailed), file=args.outfile) else: for e in entailed: print(parse.display(e[0]), file=args.outfile) sys.exit() # Handle abduction if args.all: solutions = etcetera.etcAbduction(obs, kb, args.depth, skolemize=skolemize) else: if args.incremental: solutions = incremental.incremental(obs, kb, args.depth, args.nbest,
inlines = args.infile.readlines() intext = "".join(inlines) kb, obs = parse.definite_clauses(parse.parse(intext)) if args.kb: kblines = args.kb.readlines() kbtext = "".join(kblines) kbkb, kbobs = parse.definite_clauses(parse.parse(kbtext)) kb.extend(kbkb) # Handle forward if args.forward: entailed = forward.forward(obs, kb) if args.graph: print(forward.graph(obs, entailed), file=args.outfile) else: for e in entailed: print(parse.display(e[0]), file=args.outfile) sys.exit() # Handle abduction if args.all: solutions = etcetera.etcAbduction(obs, kb, args.depth) else: solutions = etcetera.nbest(obs, kb, args.depth, args.nbest) if args.graph: solution = solutions[args.solution - 1] print(forward.graph(solution, forward.forward(solution, kb), targets=obs),
def xbestproof(q, kb, depth, x): xbest = etcetera.nbest(q.given(), kb, depth, x + 1)[x] return(forward.graph(xbest, forward.forward(xbest, kb), targets=q.given()))
def workflow(q, kb, depth): best = etcetera.nbest(q.given(), kb, depth, 1)[0] return(forward.graph(best, forward.forward(best, kb), targets=q.given()))
def xbestproof(q, kb, depth, x): xbest = etcetera.nbest(q.given(), kb, depth, x + 1)[x] return (forward.graph(xbest, forward.forward(xbest, kb), targets=q.given()))
def workflow(q, kb, depth): best = etcetera.nbest(q.given(), kb, depth, 1)[0] return (forward.graph(best, forward.forward(best, kb), targets=q.given()))