class_docstr: Qa Evaluator. Now, we support metrics `'bleu'`
      
class_docstr_tok: ["Qa","Evaluator",".","Now",",","we","support","metrics","`","'bleu","'","`"]
code: def _f1_score(self, prediction, ground_truth):
      prediction_tokens = self._normalize_answer(prediction).split()
      ground_truth_tokens = self._normalize_answer(ground_truth).split()
      common = Counter(prediction_tokens) & Counter(ground_truth_tokens)
      num_same = sum(common.values())
      if num_same == 0:
          return 0
      precision = 1.0 * num_same / len(prediction_tokens)
      recall = 1.0 * num_same / len(ground_truth_tokens)
      f1 = (2 * precision * recall) / (precision + recall)
      return f1
  
file_path: TextBox/textbox/evaluator/qa_evaluator.py
imports: import string
  import re
  import numpy
  from .abstract_evaluator import AbstractEvaluator
  from collections import Counter
label_desc: Use image node_id 3 for calling the QaEvaluator obj's underlying member method code with example usage: obj._f1_score(prediction, ground_truth) and returns: f1, int