def _GenerateSummaryFromErrs(nref, errs):
  """Generate strings to summarize word errors.

  Args:
    nref: integer of total words in references
    errs: dict of three types of errors. e.g. {'sub':10, 'ins': 15, 'del': 3}

  Returns:
    str1: string summarizing total error, total word, WER,
    str2: string breaking down three errors: deleting, insertion, substitute
  """

  total_error = sum(errs.values())
  str_sum = 'total error = %d, total word = %d, wer = %.2f%%' % (
      total_error, nref, total_error * 100.0 / nref)

  str_details = 'Error breakdown: del = %.2f%%, ins=%.2f%%, sub=%.2f%%' % (
      errs['del'] * 100.0 / nref, errs['ins'] * 100.0 / nref,
      errs['sub'] * 100.0 / nref)

  return str_sum, str_details