code: def test_bilou_tags_to_slots(self):
      # Given
      language = LANGUAGE_EN
      slot_name = "animal"
      intent_slots_mapping = {"animal": "animal"}
      tags = [
          {"text": "", "tags": [], "expected_slots": []},
          {
              "text": "nothing here",
              "tags": [OUTSIDE, OUTSIDE],
              "expected_slots": [],
          },
          {
              "text": "i am a blue bird",
              "tags": [
                  OUTSIDE,
                  OUTSIDE,
                  OUTSIDE,
                  BEGINNING_PREFIX + slot_name,
                  LAST_PREFIX + slot_name,
              ],
              "expected_slots": [
                  unresolved_slot(
                      match_range=(7, 16),
                      value="blue bird",
                      entity=slot_name,
                      slot_name=slot_name,
                  )
              ],
          },
          {
              "text": "i am a bird",
              "tags": [
                  OUTSIDE,
                  OUTSIDE,
                  OUTSIDE,
                  UNIT_PREFIX + slot_name,
              ],
              "expected_slots": [
                  unresolved_slot(
                      match_range=(7, 11),
                      value="bird",
                      entity=slot_name,
                      slot_name=slot_name,
                  )
              ],
          },
          {
              "text": "bird",
              "tags": [UNIT_PREFIX + slot_name],
              "expected_slots": [
                  unresolved_slot(
                      match_range=(0, 4),
                      value="bird",
                      entity=slot_name,
                      slot_name=slot_name,
                  )
              ],
          },
          {
              "text": "blue bird",
              "tags": [
                  BEGINNING_PREFIX + slot_name,
                  LAST_PREFIX + slot_name,
              ],
              "expected_slots": [
                  unresolved_slot(
                      match_range=(0, 9),
                      value="blue bird",
                      entity=slot_name,
                      slot_name=slot_name,
                  )
              ],
          },
          {
              "text": "light blue bird blue bird",
              "tags": [
                  BEGINNING_PREFIX + slot_name,
                  INSIDE_PREFIX + slot_name,
                  LAST_PREFIX + slot_name,
                  BEGINNING_PREFIX + slot_name,
                  LAST_PREFIX + slot_name,
              ],
              "expected_slots": [
                  unresolved_slot(
                      match_range=(0, 15),
                      value="light blue bird",
                      entity=slot_name,
                      slot_name=slot_name,
                  ),
                  unresolved_slot(
                      match_range=(16, 25),
                      value="blue bird",
                      entity=slot_name,
                      slot_name=slot_name,
                  ),
              ],
          },
          {
              "text": "bird birdy",
              "tags": [
                  UNIT_PREFIX + slot_name,
                  UNIT_PREFIX + slot_name,
              ],
              "expected_slots": [
                  unresolved_slot(
                      match_range=(0, 4),
                      value="bird",
                      entity=slot_name,
                      slot_name=slot_name,
                  ),
                  unresolved_slot(
                      match_range=(5, 10),
                      value="birdy",
                      entity=slot_name,
                      slot_name=slot_name,
                  ),
              ],
          },
          {
              "text": "light bird bird blue bird",
              "tags": [
                  BEGINNING_PREFIX + slot_name,
                  INSIDE_PREFIX + slot_name,
                  UNIT_PREFIX + slot_name,
                  BEGINNING_PREFIX + slot_name,
                  INSIDE_PREFIX + slot_name,
              ],
              "expected_slots": [
                  unresolved_slot(
                      match_range=(0, 10),
                      value="light bird",
                      entity=slot_name,
                      slot_name=slot_name,
                  ),
                  unresolved_slot(
                      match_range=(11, 15),
                      value="bird",
                      entity=slot_name,
                      slot_name=slot_name,
                  ),
                  unresolved_slot(
                      match_range=(16, 25),
                      value="blue bird",
                      entity=slot_name,
                      slot_name=slot_name,
                  ),
              ],
          },
          {
              "text": "bird bird bird",
              "tags": [
                  LAST_PREFIX + slot_name,
                  BEGINNING_PREFIX + slot_name,
                  UNIT_PREFIX + slot_name,
              ],
              "expected_slots": [
                  unresolved_slot(
                      match_range=(0, 4),
                      value="bird",
                      entity=slot_name,
                      slot_name=slot_name,
                  ),
                  unresolved_slot(
                      match_range=(5, 9),
                      value="bird",
                      entity=slot_name,
                      slot_name=slot_name,
                  ),
                  unresolved_slot(
                      match_range=(10, 14),
                      value="bird",
                      entity=slot_name,
                      slot_name=slot_name,
                  ),
              ],
          },
      ]
  
      for data in tags:
          # When
          slots = tags_to_slots(
              data["text"],
              tokenize(data["text"], language),
              data["tags"],
              TaggingScheme.BILOU,
              intent_slots_mapping,
          )
          # Then
          self.assertEqual(slots, data["expected_slots"])
  
imports: from __future__ import unicode_literals
  from builtins import range
  from mock import patch
  from snips_nlu.constants import LANGUAGE_EN
  from snips_nlu.preprocessing import Token, tokenize
  from snips_nlu.result import unresolved_slot
  from snips_nlu.slot_filler.crf_utils import BEGINNING_PREFIX, INSIDE_PREFIX, LAST_PREFIX, OUTSIDE, TaggingScheme, UNIT_PREFIX, end_of_bilou_slot, end_of_bio_slot, negative_tagging, positive_tagging, start_of_bilou_slot, start_of_bio_slot, tags_to_slots, utterance_to_sample
  from snips_nlu.tests.utils import SnipsTest
label_desc: Use image node_id 3 for calling the TestCRFUtils obj's underlying member method code with example usage: obj.test_bilou_tags_to_slots() without return types