class_docstr: Holds utility methods to work with a tokenized text and entity spans.
  
  Spans must be tuples containing the label (str), start char idx (int), and end char idx (int).
  
  Args:
      text: The text the spans refer to.
      tokens: The tokens of the text.
docstr: Convert spans to IOB tags.
  
  Args:
      spans: Spans to transform into IOB tags.
  
  Returns:
      The IOB tags.
  
  Raises:
      ValueError: If spans overlap, the IOB format does not support overlapping spans.
docstr_tok: ["Convert","spans","to","IOB","tags",".","Args",":","spans",":","Spans","to","transform","into","IOB","tags",".","Returns",":","The","IOB","tags",".","Raises",":","ValueError",":","If","spans","overlap",",","the","IOB","format","does","not","support","overlapping","spans","."]
code: def to_tags(self, spans: List[Tuple[str, int, int]]) -> List[str]:
      """Convert spans to IOB tags.
  
      Args:
          spans: Spans to transform into IOB tags.
  
      Returns:
          The IOB tags.
  
      Raises:
          ValueError: If spans overlap, the IOB format does not support overlapping spans.
      """
      # check for overlapping spans
      sorted_spans = sorted(spans, key=lambda x: x[1])
      for i in range(1, len(spans)):
          if sorted_spans[i - 1][2] > sorted_spans[i][1]:
              raise ValueError(
                  "IOB tags cannot handle overlapping spans!"
              )
  
      tags = ["O"] * len(self.tokens)
      for span in spans:
          start_token_idx = self._start_to_token_idx[span[1]]
          end_token_idx = self._end_to_token_idx[span[2]]
  
          tags[start_token_idx] = f"B-{span[0]}"
          for token_idx in range(
              start_token_idx + 1, end_token_idx + 1
          ):
              tags[token_idx] = f"I-{span[0]}"
  
      return tags
  
file_path: argilla/src/argilla/utils/span_utils.py
imports: from typing import Dict, List, Optional, Tuple
label_desc: Use image node_id 8 for calling the SpanUtils obj's underlying member method code with example usage: obj.to_tags(spans) and returns: tags