code: def tuple_to_metric(c_tuple, n_tuple):
      (tp_c, c_k, c_r), (tp_n, n_k, n_r) = c_tuple, n_tuple
  
      if not c_k and not c_r:
          R_c, P_c, F_c = (1.0, 1.0, 1.0)
      elif not c_k or not c_r:
          R_c, P_c, F_c = (0.0, 0.0, 0.0)
      else:
          R_c, P_c = tp_c / c_k, tp_c / c_r
          F_c = 2 * tp_c / (c_k + c_r)
  
      if not n_k and not n_r:
          R_n, P_n, F_n = (1.0, 1.0, 1.0)
      elif not n_k or not n_r:
          R_n, P_n, F_n = (0.0, 0.0, 0.0)
      else:
          R_n, P_n = tp_n / n_k, tp_n / n_r
          F_n = 2 * tp_n / (n_k + n_r)
      return ((P_c, R_c, F_c), (P_n, R_n, F_n))
  
file_path: DeepKE/src/deepke/triple_extraction/ASP/metrics/blanc.py
imports: import math
  import typing
  import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: tuple_to_metric(c_tuple, n_tuple) and returns: P_c,  R_c,  F_c,  P_n,  R_n,  F_n