docstr: 给定一个tags的lis，比如['S-song', 'B-singer', 'M-singer', 'E-singer', 'S-moive', 'S-actor']。
  返回[('song', (0, 1)), ('singer', (1, 4)), ('moive', (4, 5)), ('actor', (5, 6))] (左闭右开区间)
  也可以是单纯的['S', 'B', 'M', 'E', 'B', 'M', 'M',...]序列
  
  :param tags: List[str],
  :param ignore_labels: List[str], 在该list中的label将被忽略
  :return: List[Tuple[str, List[int, int]]]. [(label，[start, end])]
code: def _bmes_tag_to_spans(tags, ignore_labels=None):
      r"""
      给定一个tags的lis，比如['S-song', 'B-singer', 'M-singer', 'E-singer', 'S-moive', 'S-actor']。
      返回[('song', (0, 1)), ('singer', (1, 4)), ('moive', (4, 5)), ('actor', (5, 6))] (左闭右开区间)
      也可以是单纯的['S', 'B', 'M', 'E', 'B', 'M', 'M',...]序列
  
      :param tags: List[str],
      :param ignore_labels: List[str], 在该list中的label将被忽略
      :return: List[Tuple[str, List[int, int]]]. [(label，[start, end])]
      """
      ignore_labels = set(ignore_labels) if ignore_labels else set()
  
      spans = []
      prev_bmes_tag = None
      for idx, tag in enumerate(tags):
          tag = tag.lower()
          bmes_tag, label = tag[:1], tag[2:]
          if bmes_tag in ("b", "s"):
              spans.append((label, [idx, idx]))
          elif (
              bmes_tag in ("m", "e")
              and prev_bmes_tag in ("b", "m")
              and label == spans[-1][0]
          ):
              spans[-1][1][1] = idx
          else:
              spans.append((label, [idx, idx]))
          prev_bmes_tag = bmes_tag
      return [
          (span[0], (span[1][0], span[1][1] + 1))
          for span in spans
          if span[0] not in ignore_labels
      ]
  
file_path: textflint/textflint/input/model/metrics/nerspanmetric.py
imports: from abc import ABC
label_desc: Use image node_id 4 for calling the NERSpanMetric obj's underlying member method code with example usage: obj._bmes_tag_to_spans(tags, ignore_labels) and returns: unknown