code: def calc_metrics(tp, p, t, percent=True):
      """
      compute overall precision, recall and FB1 (default values are 0.0)
      if percent is True, return 100 * original decimal value
      """
      precision = tp / p if p else 0
      recall = tp / t if t else 0
      fb1 = (
          2 * precision * recall / (precision + recall)
          if precision + recall
          else 0
      )
      if percent:
          return 100 * precision, 100 * recall, 100 * fb1
      else:
          return precision, recall, fb1
  
file_path: graph4nlp/examples/pytorch/name_entity_recognition/conlleval.py
imports: from __future__ import division, print_function, unicode_literals
  import sys
  from collections import defaultdict
label_desc: Use image node_id 4 for calling a global function with example usage: calc_metrics(tp, p, t, percent) and returns: unknown,  unknown,  unknown, precision,  recall,  fb1