code: def get_result(
      correct_chunks,
      true_chunks,
      pred_chunks,
      correct_counts,
      true_counts,
      pred_counts,
      verbose=True,
  ):
      """
      if verbose, print overall performance, as well as preformance per chunk type;
      otherwise, simply return overall prec, rec, f1 scores
      """
      # sum counts
      sum_correct_chunks = sum(correct_chunks.values())
      sum_true_chunks = sum(true_chunks.values())
      sum_pred_chunks = sum(pred_chunks.values())
  
      sum_correct_counts = sum(correct_counts.values())
      sum_true_counts = sum(true_counts.values())
  
      nonO_correct_counts = sum(
          v for k, v in correct_counts.items() if k != "O"
      )
      nonO_true_counts = sum(
          v for k, v in true_counts.items() if k != "O"
      )
  
      chunk_types = sorted(set(list(true_chunks) + list(pred_chunks)))
  
      # compute overall precision, recall and FB1 (default values are 0.0)
      prec, rec, f1 = calc_metrics(
          sum_correct_chunks, sum_pred_chunks, sum_true_chunks
      )
      res = (prec, rec, f1)
      if not verbose:
          return res
  
      # print overall performance, and performance per chunk type
  
      print(
          "processed %i tokens with %i phrases; "
          % (sum_true_counts, sum_true_chunks),
          end="",
      )
      print(
          "found: %i phrases; correct: %i.\n"
          % (sum_pred_chunks, sum_correct_chunks),
          end="",
      )
  
      print(
          "accuracy: %6.2f%%; (non-O)"
          % (100 * nonO_correct_counts / nonO_true_counts)
      )
      print(
          "accuracy: %6.2f%%; "
          % (100 * sum_correct_counts / sum_true_counts),
          end="",
      )
      print(
          "precision: %6.2f%%; recall: %6.2f%%; FB1: %6.2f"
          % (prec, rec, f1)
      )
  
      # for each chunk type, compute precision, recall and FB1 (default values are 0.0)
      for t in chunk_types:
          prec, rec, f1 = calc_metrics(
              correct_chunks[t], pred_chunks[t], true_chunks[t]
          )
          print("%17s: " % t, end="")
          print(
              "precision: %6.2f%%; recall: %6.2f%%; FB1: %6.2f"
              % (prec, rec, f1),
              end="",
          )
          print("  %d" % pred_chunks[t])
  
      return res
  
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 6 for calling a global function with example usage: get_result(correct_chunks, true_chunks, pred_chunks, correct_counts, true_counts, pred_counts, verbose) and returns: res, res