class_docstr: Taken from the official evaluation script for v1.1 of the SQuAD dataset
class_docstr_tok: ["Taken","from","the","official","evaluation","script","for","v1.1","of","the","SQuAD","dataset"]
code: def update(self, pred: str, target: Union[str, List[str]]):
      if isinstance(target, str):
          self.correct += self.f1_score(pred, target)
      elif isinstance(target, list):
          self.correct += max(
              [self.f1_score(pred, tgt) for tgt in target]
          )
      self.total += 1
  
imports: import logging
  import re
  import string
  from collections import Counter
  from typing import List, Union
  import torch
  from torchmetrics import Metric
label_desc: Use image node_id 2 for calling the TokenF1Score obj's underlying member method code with example usage: obj.update(pred, target) without return types