class_docstr: An abstract class representing a metric which accumulates TPs, FPs, and FNs.
  
  :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).
class_docstr_tok: ["An","abstract","class","representing","a","metric","which","accumulates","TPs",",","FPs",",","and","FNs",".",":","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",")","."]
docstr: This static method allows to build a Metric object.
  
  :param metric: The metric to be returned.
  :param average: The average to be applied at label level.
  :param distance: When distance-based F1 is chosen,                it specifies which distance is being applied.
  :return: The `Metric` object as specified by params.
docstr_tok: ["This","static","method","allows","to","build","a","Metric","object",".",":","param","metric",":","The","metric","to","be","returned",".",":","param","average",":","The","average","to","be","applied","at","label","level",".",":","param","distance",":","When","distance-based","F1","is","chosen",",","it","specifies","which","distance","is","being","applied",".",":","return",":","The","`","Metric","`","object","as","specified","by","params","."]
code: def get_instance(
      metric: str, average: str = "micro", distance: str = "word"
  ) -> "ErrorMetric":
      """
          This static method allows to build a Metric object.
  
          :param metric: The metric to be returned.
          :param average: The average to be applied at label level.
          :param distance: When distance-based F1 is chosen,\
                  it specifies which distance is being applied.
          :return: The `Metric` object as specified by params.
  
          """
      assert metric in METRIC_OPTIONS, "Allowed metrics: {}".format(
          METRIC_OPTIONS
      )
      if metric == "f1":
          return FMeasure(average=average)
      if metric == "span_f1":
          return SpanFMeasure(average=average)
      if metric == "span_distance_f1":
          return SpanDistanceFMeasure(
              average=average, distance=distance
          )
      if metric == "slu_f1":
          return SLUF1(average=average)
  
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 5 for calling the ErrorMetric obj's underlying member method code with example usage: obj.get_instance(metric, average, distance) and returns: FMeasure, SpanFMeasure, SpanDistanceFMeasure, SLUF1