class_docstr: This metric is a generalisation of the `SpanFMeasure`,            particularly suitable for measuring entity prediction scores
  in SLU tasks. A distance function is used to smooth the negative            contribution of wrong transcription. In particular,
  for every label match, the lexical distance between gold and predicted            fillers contributes to FPs and FNs count.
  For more information, please see `SLURP: A Spoken Language Understanding            Resource Package` by Bastianelli, Vanzo,
  Swietojanski, and Rieser.
  
  :param average: This determines the type of averaging performed            on the data: 'micro' (calculate metrics globally
  by counting the total true positives, false negatives and false positives),            'macro' (calculate metrics for each
  label, and find their unweighted mean).
  :param distance: The distance function being applied.            `word` applies WER, whereas `char` applies the Levenshtein
  distance.
class_docstr_tok: ["This","metric","is","a","generalisation","of","the","`","SpanFMeasure","`",",","particularly","suitable","for","measuring","entity","prediction","scores","in","SLU","tasks",".","A","distance","function","is","used","to","smooth","the","negative","contribution","of","wrong","transcription",".","In","particular",",","for","every","label","match",",","the","lexical","distance","between","gold","and","predicted","fillers","contributes","to","FPs","and","FNs","count",".","For","more","information",",","please","see","`","SLURP",":","A","Spoken","Language","Understanding","Resource","Package","`","by","Bastianelli",",","Vanzo",",","Swietojanski",",","and","Rieser",".",":","param","average",":","This","determines","the","type","of","averaging","performed","on","the","data",":","'micro","'","(","calculate","metrics","globally","by","counting","the","total","true","positives",",","false","negatives","and","false","positives",")",",","'macro","'","(","calculate","metrics","for","each","label",",","and","find","their","unweighted","mean",")",".",":","param","distance",":","The","distance","function","being","applied",".","`","word","`","applies","WER",",","whereas","`","char","`","applies","the","Levenshtein","distance","."]
docstr: This method accumulates TPs, FPs, and FNs for each span label,                taking into account the distance function being
  applied.
  
  :param gold: A list of gold entities, each defined by a dictionary                with `type` and `filler` keys.
  :param prediction: A list of gold entities, each defined                by a dictionary with `type` and `filler` keys.
docstr_tok: ["This","method","accumulates","TPs",",","FPs",",","and","FNs","for","each","span","label",",","taking","into","account","the","distance","function","being","applied",".",":","param","gold",":","A","list","of","gold","entities",",","each","defined","by","a","dictionary","with","`","type","`","and","`","filler","`","keys",".",":","param","prediction",":","A","list","of","gold","entities",",","each","defined","by","a","dictionary","with","`","type","`","and","`","filler","`","keys","."]
code: def __call__(
      self, gold: List[Dict[str, str]], prediction: List[Dict[str, str]]
  ) -> None:
      """
          This method accumulates TPs, FPs, and FNs for each span label,\
                  taking into account the distance function being
          applied.
  
          :param gold: A list of gold entities, each defined by a dictionary\
                  with `type` and `filler` keys.
          :param prediction: A list of gold entities, each defined\
                  by a dictionary with `type` and `filler` keys.
          """
      gold_labels, gold_fillers = split_spans(gold)
      predicted_labels, predicted_fillers = split_spans(prediction)
  
      for j, pred_label in enumerate(predicted_labels):
          if pred_label in gold_labels:
              idx_to_remove, distance = self._get_lowest_distance(
                  pred_label,
                  predicted_fillers[j],
                  gold_labels,
                  gold_fillers,
              )
              self._true_positives[pred_label] += 1
              self._false_positives[pred_label] += distance
              self._false_negatives[pred_label] += distance
              gold_labels.pop(idx_to_remove)
              gold_fillers.pop(idx_to_remove)
          else:
              self._false_positives[pred_label] += 1
      for i, gold_label in enumerate(gold_labels):
          self._false_negatives[gold_label] += 1
  
imports: from collections import defaultdict
  from copy import copy
  from typing import Dict, List, Set, Tuple
  from .distance import Distance
label_desc: Use image node_id 2 for calling the SpanDistanceFMeasure obj's underlying member method code with example usage: obj.__call__(gold, prediction) without return types