def get_data_pairs(self,
                     max_examples=None,
                     num_resampling=1,
                     other_objects_sample_percentage=0.5,
                     split_type="uniform",
                     visualize_per_template=0,
                     visualize_per_split=0,
                     train_percentage=0.8,
                     min_other_objects=0,
                     max_objects=12,
                     k_shot_generalization=0,
                     make_dev_set=False,
                     cut_off_target_length=25,
                     max_distract_objects=1,
                     max_examples_per_target=None):
    """Generate a set of situations and generate all possible commands."""
    if k_shot_generalization > 0 and split_type == "uniform":
      logging.info(
          "WARNING: k_shot_generalization set to %d but for split_type"
          "uniform this is not used.", k_shot_generalization)

    # Save current situation of the world for later restoration.
    current_situation = self._world.get_current_situation()
    current_mission = self._world.mission
    self.reset_dataset()

    # Generate all situations and commands.
    situation_specifications = self.generate_situations(
        num_resampling=num_resampling)
    self.generate_all_commands()
    example_count, dropped_examples, dropped_situations = self.generate_data(
        situation_specifications,
        max_examples=max_examples,
        other_objects_sample_percentage=other_objects_sample_percentage,
        split_type=split_type,
        visualize_per_template=visualize_per_template,
        visualize_per_split=visualize_per_split,
        train_percentage=train_percentage,
        min_other_objects=min_other_objects,
        max_objects=max_objects,
        cut_off_target_length=cut_off_target_length,
        max_distract_objects=max_distract_objects,
        max_examples_per_target=max_examples_per_target)
    logging.info("Dropped %d examples due to "
                 "belonging to multiple splits.", dropped_examples)
    logging.info(
        "Dropped %d situations due to "
        "invalid reference object initialization.", dropped_situations)

    if split_type in ["generalization", "spatial_relation"]:
      self.make_test_set(
          percentage=(1 - self._percentage_train), type_set="test")
    logging.info("Discarding equivalent examples, may take a while...")
    equivalent_examples = self.discard_equivalent_examples()
    logging.info(
        "Discarded %d examples from the test set that"
        "were already in the training set.", equivalent_examples)
    logging.info("Number of examples: %d", example_count + 1)

    if make_dev_set:
      self.make_test_set(percentage=self._percentage_dev, type_set="dev")

    if k_shot_generalization > 0:
      if split_type == "generalization":
        self.move_k_examples_to_train(k_shot_generalization, split="adverb_1")

    # restore situation
    self.initialize_world(current_situation, mission=current_mission)
Generate a set of situations and generate all possible commands.
language/gscan/data/dataset.py