示例#1
0
    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,
示例#2
0
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),
示例#3
0
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()))
示例#4
0
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()))
示例#5
0
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()))
示例#6
0
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()))