MCPcopy Create free account
hub / github.com/awslabs/gap-text2sql / evaluate

Function evaluate

rat-sql-gap/seq2struct/datasets/spider_lib/evaluation.py:605–625  ·  view source on GitHub ↗
(gold, predict, db_dir, etype, kmaps)

Source from the content-addressed store, hash-verified

603
604
605def evaluate(gold, predict, db_dir, etype, kmaps):
606 with open(gold) as f:
607 glist = [l.strip().split('\t') for l in f.readlines() if len(l.strip()) > 0]
608
609 with open(predict) as f:
610 plist = [l.strip().split('\t') for l in f.readlines() if len(l.strip()) > 0]
611 # plist = [("select max(Share),min(Share) from performance where Type != 'terminal'", "orchestra")]
612 # glist = [("SELECT max(SHARE) , min(SHARE) FROM performance WHERE TYPE != 'Live final'", "orchestra")]
613 evaluator = Evaluator(db_dir, kmaps, etype)
614 results = []
615 for p, g in zip(plist, glist):
616 predicted, = p
617 gold, db_name = g
618 results.append(evaluator.evaluate_one(db_name, gold, predicted))
619 evaluator.finalize()
620
621 print_scores(evaluator.scores, etype)
622 return {
623 'per_item': results,
624 'total_scores': evaluator.scores,
625 }
626
627
628def eval_exec_match(db, p_str, g_str, pred, gold):

Callers 1

evaluation.pyFile · 0.85

Calls 5

evaluate_oneMethod · 0.95
finalizeMethod · 0.95
EvaluatorClass · 0.85
print_scoresFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected