code: def compute_f1(list_ref, list_hyp):
      """Compute F1 score from reference (grouth truth) list and hypothesis list.
      Args:
        list_ref: List of true elements.
        list_hyp: List of postive (retrieved) elements.
      Returns:
        A F1Scores object containing F1, precision, and recall scores.
      """
  
      ref = collections.Counter(list_ref)
      hyp = collections.Counter(list_hyp)
      true = sum(ref.values())
      positive = sum(hyp.values())
      true_positive = sum((ref & hyp).values())
      precision = float(true_positive) / positive if positive else 1.0
      recall = float(true_positive) / true if true else 1.0
      if precision + recall > 0.0:
          f1 = 2.0 * precision * recall / (precision + recall)
      else:  # The F1-score is defined to be 0 if both precision and recall are 0.
          f1 = 0.0
  
      return F1Scores(f1=f1, precision=precision, recall=recall)
  
file_path: NeMo/nemo/collections/nlp/metrics/sgd_metrics.py
imports: import collections
  import numpy
  from rapidfuzz import fuzz
label_desc: Use image node_id 1 for calling a global function with example usage: compute_f1(list_ref, list_hyp) and returns: F1Scores