class_docstr: Base class to transform the dialogue state into an ML format.
  
  Subclasses of SingleStateFeaturizer will decide how a bot will
  transform the dialogue state into a dictionary mapping an attribute
  to its features. Possible attributes are: `INTENT`, `TEXT`, `ACTION_NAME`,
  `ACTION_TEXT`, `ENTITIES`, `SLOTS` and `ACTIVE_LOOP`. Each attribute will be
  featurized into a list of `rasa.utils.features.Features`.
class_docstr_tok: ["Base","class","to","transform","the","dialogue","state","into","an","ML","format",".","Subclasses","of","SingleStateFeaturizer","will","decide","how","a","bot","will","transform","the","dialogue","state","into","a","dictionary","mapping","an","attribute","to","its","features",".","Possible","attributes","are",":","`","INTENT","`",",","`","TEXT","`",",","`","ACTION_NAME","`",",","`","ACTION_TEXT","`",",","`","ENTITIES","`",",","`","SLOTS","`","and","`","ACTIVE_LOOP","`",".","Each","attribute","will","be","featurized","into","a","list","of","`","rasa.utils.features.Features","`","."]
docstr: Returns the tag to index mapping for entities.
  
  Returns:
      Tag to index mapping.
docstr_tok: ["Returns","the","tag","to","index","mapping","for","entities",".","Returns",":","Tag","to","index","mapping","."]
code: def _create_entity_tag_specs(
      self, bilou_tagging: bool = False
  ) -> List[EntityTagSpec]:
      """Returns the tag to index mapping for entities.
  
      Returns:
          Tag to index mapping.
      """
      if ENTITIES not in self._default_feature_states:
          return []
  
      if bilou_tagging:
          tag_id_index_mapping = {
              f"{prefix}{tag}": idx_1 * len(BILOU_PREFIXES) + idx_2 + 1
              for tag, idx_1 in self._default_feature_states[
                  ENTITIES
              ].items()
              for idx_2, prefix in enumerate(BILOU_PREFIXES)
          }
      else:
          tag_id_index_mapping = {
              tag: idx + 1  # +1 to keep 0 for the NO_ENTITY_TAG
              for tag, idx in self._default_feature_states[
                  ENTITIES
              ].items()
          }
  
      # NO_ENTITY_TAG corresponds to non-entity which should correspond to 0 index
      # needed for correct prediction for padding
      tag_id_index_mapping[NO_ENTITY_TAG] = 0
  
      # TODO
      #  The entity states used to create the tag-idx-mapping contains the
      #  entities and the concatenated entity and roles/groups. We do not
      #  distinguish between entities and roles/groups right now.
      #  we return a list to anticipate that
      return [
          EntityTagSpec(
              tag_name=ENTITY_ATTRIBUTE_TYPE,
              tags_to_ids=tag_id_index_mapping,
              ids_to_tags={
                  value: key
                  for key, value in tag_id_index_mapping.items()
              },
              num_tags=len(tag_id_index_mapping),
          )
      ]
  
imports: import logging
  import numpy
  import scipy.sparse
  from typing import List, Optional, Dict, Text, Set, Any
  from rasa.core.featurizers.precomputation import MessageContainerForCoreFeaturization
  from rasa.nlu.extractors.extractor import EntityTagSpec
  from rasa.nlu.utils import bilou_utils
  from rasa.nlu.utils.bilou_utils import BILOU_PREFIXES
  from rasa.shared.core.domain import SubState, State, Domain
  from rasa.shared.core.constants import PREVIOUS_ACTION, ACTIVE_LOOP, USER, SLOTS
  from rasa.shared.core.trackers import is_prev_action_listen_in_state
  from rasa.shared.nlu.constants import ENTITIES, FEATURE_TYPE_SENTENCE, ACTION_TEXT, ACTION_NAME, INTENT, NO_ENTITY_TAG, ENTITY_ATTRIBUTE_TYPE, ENTITY_TAGS, TEXT
  from rasa.shared.nlu.training_data.features import Features
  from rasa.utils.tensorflow import model_data_utils
label_desc: Use image node_id 2 for calling the SingleStateFeaturizer obj's underlying member method code with example usage: obj._create_entity_tag_specs(bilou_tagging) and returns: list, list