class_docstr: Logs attack results to a CSV.
class_docstr_tok: ["Logs","attack","results","to","a","CSV","."]
code: def log_attack_result(self, result):
      original_text, perturbed_text = result.diff_color(
          self.color_method
      )
      original_text = original_text.replace(
          "\n", AttackedText.SPLIT_TOKEN
      )
      perturbed_text = perturbed_text.replace(
          "\n", AttackedText.SPLIT_TOKEN
      )
      result_type = result.__class__.__name__.replace(
          "AttackResult", ""
      )
      row = {
          "original_text": original_text,
          "perturbed_text": perturbed_text,
          "original_score": result.original_result.score,
          "perturbed_score": result.perturbed_result.score,
          "original_output": result.original_result.output,
          "perturbed_output": result.perturbed_result.output,
          "ground_truth_output": result.original_result.ground_truth_output,
          "num_queries": result.num_queries,
          "result_type": result_type,
      }
      self.row_list.append(row)
      self.df = pd.DataFrame.from_records(self.row_list)
      self._flushed = False
  
file_path: TextAttack/textattack/loggers/csv_logger.py
imports: import csv
  import pandas
  from textattack.shared import AttackedText, logger
  from .logger import Logger
label_desc: Use image node_id 2 for calling the CSVLogger obj's underlying member method code with example usage: obj.log_attack_result(result) without return types