(results_dict, dir_to_write)
Log ROUGE results to screen and write to file.

  Args:
    results_dict: the dictionary returned by pyrouge
    dir_to_write: the directory where we will write the results to
Log ROUGE results to screen and write to file.
Log ROUGE results to screen and write to file .
def rouge_log(results_dict, dir_to_write):
  """Log ROUGE results to screen and write to file.

  Args:
    results_dict: the dictionary returned by pyrouge
    dir_to_write: the directory where we will write the results to"""
  log_str = ""
  for x in ["1","2","l"]:
    log_str += "\nROUGE-%s:\n" % x
    for y in ["f_score", "recall", "precision"]:
      key = "rouge_%s_%s" % (x,y)
      key_cb = key + "_cb"
      key_ce = key + "_ce"
      val = results_dict[key]
      val_cb = results_dict[key_cb]
      val_ce = results_dict[key_ce]
      log_str += "%s: %.4f with confidence interval (%.4f, %.4f)\n" % (key, val, val_cb, val_ce)
  tf.logging.info(log_str) # log to screen
  results_file = os.path.join(dir_to_write, "ROUGE_results.txt")
  tf.logging.info("Writing final ROUGE results to %s...", results_file)
  with open(results_file, "w") as f:
    f.write(log_str)
def rouge_log ( results_dict , dir_to_write ) : log_str = "" for x in [ "1" , "2" , "l" ] : log_str += "\nROUGE-%s:\n" % x for y in [ "f_score" , "recall" , "precision" ] : key = "rouge_%s_%s" % ( x , y ) key_cb = key + "_cb" key_ce = key + "_ce" val = results_dict [ key ] val_cb = results_dict [ key_cb ] val_ce = results_dict [ key_ce ] log_str += "%s: %.4f with confidence interval (%.4f, %.4f)\n" % ( key , val , val_cb , val_ce ) tf . logging . info ( log_str ) # log to screen results_file = os . path . join ( dir_to_write , "ROUGE_results.txt" ) tf . logging . info ( "Writing final ROUGE results to %s..." , results_file ) with open ( results_file , "w" ) as f : f . write ( log_str )