code: def test_bio_tags_to_spans_extracts_correct_spans_without_labels(
      self,
  ):
      tag_sequence = ["O", "B", "I", "O", "B", "I", "B", "B"]
      spans = span_utils.bio_tags_to_spans(tag_sequence)
      assert set(spans) == {
          ("", (1, 2)),
          ("", (4, 5)),
          ("", (6, 6)),
          ("", (7, 7)),
      }
  
      # Check that it raises when we use U- tags for single tokens.
      tag_sequence = ["O", "B", "I", "O", "B", "I", "U", "U"]
      with pytest.raises(span_utils.InvalidTagSequence):
          spans = span_utils.bio_tags_to_spans(tag_sequence)
  
      # Check that invalid BIO sequences are also handled as spans.
      tag_sequence = ["O", "B", "I", "O", "I", "B", "I", "B", "I", "I"]
      spans = span_utils.bio_tags_to_spans(tag_sequence)
      assert set(spans) == {
          ("", (1, 2)),
          ("", (4, 4)),
          ("", (5, 6)),
          ("", (7, 9)),
      }
  
file_path: allennlp/tests/data/dataset_readers/dataset_utils/span_utils_test.py
imports: from typing import List
  import pytest
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.data.dataset_readers.dataset_utils import span_utils
  from allennlp.data.tokenizers import Token, SpacyTokenizer
label_desc: Use image node_id 2 for calling the SpanUtilsTest obj's underlying member method code with example usage: obj.test_bio_tags_to_spans_extracts_correct_spans_without_labels() without return types