class_docstr: An attack generates adversarial examples on text.
  
  This is an abstract class that contains main helper functionality for
  attacks. An attack is comprised of a search method, goal function,
  a transformation, and a set of one or more linguistic constraints that
  successful examples must meet.
class_docstr_tok: ["An","attack","generates","adversarial","examples","on","text",".","This","is","an","abstract","class","that","contains","main","helper","functionality","for","attacks",".","An","attack","is","comprised","of","a","search","method",",","goal","function",",","a","transformation",",","and","a","set","of","one","or","more","linguistic","constraints","that","successful","examples","must","meet","."]
docstr: Runs an attack on the given dataset and outputs the results to the
  console and the output file.
  
  :param dataset: An iterable of (text, ground_truth_output) pairs.
  :param indices: An iterable of indices of the dataset that we want to
      attack. If None, attack all samples in dataset.
  :return: tuple of original dataset and transformed dataset.
docstr_tok: ["Runs","an","attack","on","the","given","dataset","and","outputs","the","results","to","the","console","and","the","output","file",".",":","param","dataset",":","An","iterable","of","(","text",",","ground_truth_output",")","pairs",".",":","param","indices",":","An","iterable","of","indices","of","the","dataset","that","we","want","to","attack",".","If","None",",","attack","all","samples","in","dataset",".",":","return",":","tuple","of","original","dataset","and","transformed","dataset","."]
code: def attack_dataset(self, dataset, indices=None):
      """
      Runs an attack on the given dataset and outputs the results to the
      console and the output file.
  
      :param dataset: An iterable of (text, ground_truth_output) pairs.
      :param indices: An iterable of indices of the dataset that we want to
          attack. If None, attack all samples in dataset.
      :return: tuple of original dataset and transformed dataset.
      """
      examples = self._get_examples_from_dataset(
          dataset, indices=indices
      )
      new_dataset = dataset.new_dataset()
      ori_dataset = dataset.new_dataset()
      for ori_sample, goal_function_result in examples:
          if (
              goal_function_result.goal_status
              != GoalFunctionResultStatus.SKIPPED
          ):
              result = self.attack_one(goal_function_result)
              train_data_dict = (
                  result.perturbed_result.attacked_text._text_input
              )
              trans_sample = ori_sample.replace_fields(
                  list(train_data_dict.keys()),
                  list(train_data_dict.values()),
              )
              new_dataset.append(trans_sample)
              ori_dataset.append(ori_sample)
      return ori_dataset, new_dataset
  
imports: import lru
  from collections import deque
  from ...common import logger
  from textattack.attack_results import FailedAttackResult, MaximizedAttackResult, SuccessfulAttackResult
  from textattack.goal_function_results import GoalFunctionResultStatus
  from textattack.shared import AttackedText, utils
  from textattack.transformations import CompositeTransformation
label_desc: Use image node_id 10 for calling the Attack obj's underlying member method code with example usage: obj.attack_dataset(dataset, indices) and returns: ori_dataset,  new_dataset