class_docstr: Truncates the tracker history into `max_history` long sequences.
  
  Creates training data from trackers where intents are the output prediction
  labels. Tracker state sequences which represent policy input are truncated
  to not excede `max_history` states.
class_docstr_tok: ["Truncates","the","tracker","history","into","`","max_history","`","long","sequences",".","Creates","training","data","from","trackers","where","intents","are","the","output","prediction","labels",".","Tracker","state","sequences","which","represent","policy","input","are","truncated","to","not","excede","`","max_history","`","states","."]
docstr: Transforms trackers to states, intent labels, and entity data.
  
  Args:
      trackers: The trackers to transform.
      domain: The domain.
      omit_unset_slots: If `True` do not include the initial values of slots.
      ignore_action_unlikely_intent: Whether to remove `action_unlikely_intent`
          from training states.
  
  Returns:
      Trackers as states, labels, and entity data.
docstr_tok: ["Transforms","trackers","to","states",",","intent","labels",",","and","entity","data",".","Args",":","trackers",":","The","trackers","to","transform",".","domain",":","The","domain",".","omit_unset_slots",":","If","`","True","`","do","not","include","the","initial","values","of","slots",".","ignore_action_unlikely_intent",":","Whether","to","remove","`","action_unlikely_intent","`","from","training","states",".","Returns",":","Trackers","as","states",",","labels",",","and","entity","data","."]
code: def training_states_labels_and_entities(
      self,
      trackers: List[DialogueStateTracker],
      domain: Domain,
      omit_unset_slots: bool = False,
      ignore_action_unlikely_intent: bool = False,
  ) -> Tuple[
      List[List[State]], List[List[Text]], List[List[Dict[Text, Any]]]
  ]:
      """Transforms trackers to states, intent labels, and entity data.
  
      Args:
          trackers: The trackers to transform.
          domain: The domain.
          omit_unset_slots: If `True` do not include the initial values of slots.
          ignore_action_unlikely_intent: Whether to remove `action_unlikely_intent`
              from training states.
  
      Returns:
          Trackers as states, labels, and entity data.
      """
      example_states = []
      example_entities = []
  
      # Store of example hashes (of both states and labels) for removing
      # duplicate training examples.
      hashed_examples = set()
      # Mapping of example state hash to set of
      # positive labels associated with the state.
      state_hash_to_label_set: DefaultDict[
          int, Set[Text]
      ] = defaultdict(set)
  
      logger.debug(
          f"Creating states and {self.LABEL_NAME} label examples from "
          f"collected trackers "
          f"(by {type(self).__name__}({type(self.state_featurizer).__name__}))..."
      )
      pbar = tqdm(
          trackers,
          desc="Processed trackers",
          disable=rasa.shared.utils.io.is_logging_disabled(),
      )
      for tracker in pbar:
          for states, label, entities in self._extract_examples(
              tracker,
              domain,
              omit_unset_slots=omit_unset_slots,
              ignore_action_unlikely_intent=ignore_action_unlikely_intent,
          ):
              if self.remove_duplicates:
                  hashed = self._hash_example(states, label)
                  if hashed in hashed_examples:
                      continue
                  hashed_examples.add(hashed)
  
              # Store all positive labels associated with a training state.
              state_hash = self._hash_example(states)
  
              # Only add unique example states unless `remove_duplicates` is `False`.
              if (
                  not self.remove_duplicates
                  or state_hash not in state_hash_to_label_set
              ):
                  example_states.append(states)
                  example_entities.append(entities)
  
              state_hash_to_label_set[state_hash].add(label[0])
  
              pbar.set_postfix(
                  {f"# {self.LABEL_NAME}": f"{len(example_states):d}"}
              )
  
      # Collect positive labels for each state example.
      example_labels = [
          list(state_hash_to_label_set[self._hash_example(state)])
          for state in example_states
      ]
  
      self._remove_user_text_if_intent(example_states)
  
      logger.debug(
          f"Created {len(example_states)} {self.LABEL_NAME} examples."
      )
  
      return example_states, example_labels, example_entities
  
imports: from __future__ import annotations
  from pathlib import Path
  from collections import defaultdict
  from abc import abstractmethod
  import jsonpickle
  import logging
  from tqdm import tqdm
  from typing import Tuple, List, Optional, Dict, Text, Union, Any, Iterator, Set, DefaultDict, cast
  import numpy
  from rasa.core.featurizers.single_state_featurizer import SingleStateFeaturizer
  from rasa.core.featurizers.precomputation import MessageContainerForCoreFeaturization
  from rasa.core.exceptions import InvalidTrackerFeaturizerUsageError
  import rasa.shared.core.trackers
  import rasa.shared.utils.io
  from rasa.shared.nlu.constants import TEXT, INTENT, ENTITIES, ACTION_NAME
  from rasa.shared.nlu.training_data.features import Features
  from rasa.shared.core.trackers import DialogueStateTracker
  from rasa.shared.core.domain import State, Domain
  from rasa.shared.core.events import Event, ActionExecuted, UserUttered
  from rasa.shared.core.constants import USER, ACTION_UNLIKELY_INTENT_NAME, PREVIOUS_ACTION
  from rasa.shared.exceptions import RasaException
  from rasa.utils.tensorflow.constants import LABEL_PAD_ID
  from rasa.utils.tensorflow.model_data import ragged_array_to_ndarray
label_desc: Use image node_id 3 for calling the IntentMaxHistoryTrackerFeaturizer obj's underlying member method code with example usage: obj.training_states_labels_and_entities(trackers, domain, omit_unset_slots, ignore_action_unlikely_intent) and returns: example_states,  example_labels,  example_entities