code: def _compute_f1_per_answer(self, a_gold, a_pred):
      gold_toks = self._get_tokens(a_gold)
      pred_toks = self._get_tokens(a_pred)
      common = Counter(gold_toks) & Counter(pred_toks)
      num_same = sum(common.values())
      if len(gold_toks) == 0 or len(pred_toks) == 0:
          # If either is no-answer, then F1 is 1 if they agree, 0 otherwise
          return int(gold_toks == pred_toks)
      if num_same == 0:
          return 0
      precision = 1.0 * num_same / len(pred_toks)
      recall = 1.0 * num_same / len(gold_toks)
      f1 = (2 * precision * recall) / (precision + recall)
      return f1
  
imports: import re
  import string
  from collections import Counter
  from itertools import zip_longest
  from typing import Dict, List
  import numpy
  from pytext.common.constants import Stage
  from pytext.metric_reporters.channel import Channel, ConsoleChannel, FileChannel
  from pytext.metric_reporters.metric_reporter import MetricReporter
  from pytext.metrics import compute_classification_metrics, LabelPrediction
  from pytext.metrics.squad_metrics import SquadMetrics
label_desc: Use image node_id 18 for calling the SquadMetricReporter obj's underlying member method code with example usage: obj._compute_f1_per_answer(a_gold, a_pred) and returns: f1, int, int