(_)
| 448 | |
| 449 | |
| 450 | def main(_): |
| 451 | reference_it = _text_reader(FLAGS.references, multiple=True) |
| 452 | generation_it = _text_reader(FLAGS.generations) |
| 453 | table_it = _table_reader(FLAGS.tables) |
| 454 | |
| 455 | if FLAGS.entailment_fn == "cooccurrence": |
| 456 | assert FLAGS.cooccurrence_counts is not None |
| 457 | logging.info("Reading %s...", FLAGS.cooccurrence_counts) |
| 458 | with tf.gfile.Open(FLAGS.cooccurrence_counts) as f: |
| 459 | cooccur_counts = json.load(f) |
| 460 | entail_method = cooccur_probability_fn(cooccur_counts) |
| 461 | else: |
| 462 | entail_method = overlap_probability |
| 463 | |
| 464 | precision, recall, f_score, all_f = parent( |
| 465 | generation_it, |
| 466 | reference_it, |
| 467 | table_it, |
| 468 | lambda_weight=FLAGS.lambda_weight, |
| 469 | smoothing=FLAGS.smoothing, |
| 470 | entailment_fn=entail_method) |
| 471 | |
| 472 | logging.info("Evaluated %d examples.", len(all_f)) |
| 473 | logging.info("Precision = %.4f Recall = %.4f F-score = %.4f", |
| 474 | precision, recall, f_score) |
| 475 | |
| 476 | if __name__ == "__main__": |
| 477 | flags.mark_flags_as_required(["references", "generations", "tables"]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…