class_docstr: Generates trackers from training data.
class_docstr_tok: ["Generates","trackers","from","training","data","."]
docstr: Given a set of story parts, generates all stories that are possible.
  
  The different story parts can end and start with checkpoints
  and this generator will match start and end checkpoints to
  connect complete stories. Afterwards, duplicate stories will be
  removed and the data is augmented (if augmentation is enabled).
docstr_tok: ["Given","a","set","of","story","parts",",","generates","all","stories","that","are","possible",".","The","different","story","parts","can","end","and","start","with","checkpoints","and","this","generator","will","match","start","and","end","checkpoints","to","connect","complete","stories",".","Afterwards",",","duplicate","stories","will","be","removed","and","the","data","is","augmented","(","if","augmentation","is","enabled",")","."]
code: def __init__(
      self,
      story_graph: StoryGraph,
      domain: Domain,
      remove_duplicates: bool = True,
      unique_last_num_states: Optional[int] = None,
      augmentation_factor: int = 50,
      tracker_limit: Optional[int] = None,
      use_story_concatenation: bool = True,
      debug_plots: bool = False,
  ):
      """Given a set of story parts, generates all stories that are possible.
  
      The different story parts can end and start with checkpoints
      and this generator will match start and end checkpoints to
      connect complete stories. Afterwards, duplicate stories will be
      removed and the data is augmented (if augmentation is enabled).
      """
      self.story_graph = story_graph.with_cycles_removed()
      if debug_plots:
          self.story_graph.visualize("story_blocks_connections.html")
  
      self.domain = domain
  
      # 10x factor is a heuristic for augmentation rounds
      max_number_of_augmented_trackers = augmentation_factor * 10
  
      self.config = ExtractorConfig(
          remove_duplicates=remove_duplicates,
          unique_last_num_states=unique_last_num_states,
          augmentation_factor=augmentation_factor,
          max_number_of_augmented_trackers=max_number_of_augmented_trackers,
          tracker_limit=tracker_limit,
          use_story_concatenation=use_story_concatenation,
          rand=random.Random(42),
      )
      # hashed featurization of all finished trackers
      self.hashed_featurizations: Set[int] = set()
  
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 1 to create a new TrainingDataGenerator object  with example: obj = TrainingDataGenerator(story_graph, domain, remove_duplicates, unique_last_num_states, augmentation_factor, tracker_limit, use_story_concatenation, debug_plots)