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: Encode the given entity data.
  
  Produce numeric entity tags for tokens.
  
  Args:
      entity_data: The dict containing the text and entity labels and locations
      precomputations: Contains precomputed features and attributes.
      bilou_tagging: indicates whether BILOU tagging should be used or not
  
  Returns:
      A dictionary of entity type to list of features.
docstr_tok: ["Encode","the","given","entity","data",".","Produce","numeric","entity","tags","for","tokens",".","Args",":","entity_data",":","The","dict","containing","the","text","and","entity","labels","and","locations","precomputations",":","Contains","precomputed","features","and","attributes",".","bilou_tagging",":","indicates","whether","BILOU","tagging","should","be","used","or","not","Returns",":","A","dictionary","of","entity","type","to","list","of","features","."]
code: def encode_entities(
      self,
      entity_data: Dict[Text, Any],
      precomputations: Optional[MessageContainerForCoreFeaturization],
      bilou_tagging: bool = False,
  ) -> Dict[Text, List[Features]]:
      """Encode the given entity data.
  
      Produce numeric entity tags for tokens.
  
      Args:
          entity_data: The dict containing the text and entity labels and locations
          precomputations: Contains precomputed features and attributes.
          bilou_tagging: indicates whether BILOU tagging should be used or not
  
      Returns:
          A dictionary of entity type to list of features.
      """
      # 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.
      if (
          not entity_data
          or not self.entity_tag_specs
          or self.entity_tag_specs[0].num_tags < 2
      ):
          # we cannot build a classifier with fewer than 2 classes
          return {}
      if precomputations is None:
          message = None
      else:
          message = precomputations.lookup_message(
              user_text=entity_data[TEXT]
          )
          message.data[ENTITIES] = entity_data[ENTITIES]
  
      if not message:
          return {}
  
      if bilou_tagging:
          bilou_utils.apply_bilou_schema_to_message(message)
  
      return {
          ENTITY_TAGS: [
              model_data_utils.get_tag_ids(
                  message, self.entity_tag_specs[0], bilou_tagging
              )
          ]
      }
  
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 10 for calling the SingleStateFeaturizer obj's underlying member method code with example usage: obj.encode_entities(entity_data, precomputations, bilou_tagging) and returns: dict, dict, dict