class_docstr: Generates trackers from training data.
class_docstr_tok: ["Generates","trackers","from","training","data","."]
docstr: This is where the augmentation magic happens.
  
  We will reuse all the trackers that reached the
  end checkpoint `None` (which is the end of a
  story) and start processing all steps again. So instead
  of starting with a fresh tracker, the second and
  all following phases will reuse a couple of the trackers
  that made their way to a story end.
  
  We need to do some cleanup before processing them again.
docstr_tok: ["This","is","where","the","augmentation","magic","happens",".","We","will","reuse","all","the","trackers","that","reached","the","end","checkpoint","`","None","`","(","which","is","the","end","of","a","story",")","and","start","processing","all","steps","again",".","So","instead","of","starting","with","a","fresh","tracker",",","the","second","and","all","following","phases","will","reuse","a","couple","of","the","trackers","that","made","their","way","to","a","story","end",".","We","need","to","do","some","cleanup","before","processing","them","again","."]
code: def _create_start_trackers_for_augmentation(
      self, story_end_trackers: List[TrackerWithCachedStates]
  ) -> TrackerLookupDict:
      """This is where the augmentation magic happens.
  
      We will reuse all the trackers that reached the
      end checkpoint `None` (which is the end of a
      story) and start processing all steps again. So instead
      of starting with a fresh tracker, the second and
      all following phases will reuse a couple of the trackers
      that made their way to a story end.
  
      We need to do some cleanup before processing them again.
      """
      next_active_trackers = defaultdict(list)
  
      if self.config.use_story_concatenation:
          ending_trackers = _subsample_array(
              story_end_trackers,
              self.config.augmentation_factor,
              rand=self.config.rand,
          )
          for t in ending_trackers:
              # this is a nasty thing - all stories end and
              # start with action listen - so after logging the first
              # actions in the next phase the trackers would
              # contain action listen followed by action listen.
              # to fix this we are going to "undo" the last action listen
  
              # tracker should be copied,
              # otherwise original tracker is updated
              aug_t = t.copy()
              aug_t.is_augmented = True
              aug_t.update(ActionReverted())
              next_active_trackers[STORY_START].append(aug_t)
  
      return next_active_trackers
  
imports: from collections import defaultdict, namedtuple, deque
  import copy
  import logging
  import random
  from contextlib import contextmanager
  from tqdm import tqdm
  from typing import Optional, List, Text, Set, Dict, Tuple, Deque, DefaultDict, Any, Iterable, Generator
  from rasa.shared.constants import DOCS_URL_STORIES
  from rasa.shared.core.constants import SHOULD_NOT_BE_SET
  from rasa.shared.core.domain import Domain, State
  from rasa.shared.core.events import ActionExecuted, UserUttered, ActionReverted, UserUtteranceReverted, Restarted, Event, SlotSet, ActiveLoop
  from rasa.shared.core.trackers import DialogueStateTracker, FrozenState
  from rasa.shared.core.slots import Slot
  from rasa.shared.core.training_data.structures import StoryGraph, STORY_START, StoryStep, RuleStep, GENERATED_CHECKPOINT_PREFIX
  from rasa.shared.utils.io import is_logging_disabled
  import rasa.shared.utils.io
label_desc: Use image node_id 12 for calling the TrainingDataGenerator obj's underlying member method code with example usage: obj._create_start_trackers_for_augmentation(story_end_trackers) and returns: next_active_trackers