<commit_before>/** Utilities for saving results */

package thunder.util

object Save {

}<commit_msg>Initial commit of Save class<commit_after>/** Utilities for saving results */

package thunder.util

import org.apache.spark.rdd.RDD


object Save {

  abstract class DataSaver(var directory: String) {

    def write(rdd: RDD[Int])

  }

  class ImageSaver(override var directory: String) extends DataSaver(directory) {

    var colorMode = new String

    def setColorMode(colorMode: String): ImageSaver = {
      this.colorMode = colorMode
      this
    }

    def write(rdd: RDD[Int]) = {
      rdd.collect()

    }

  }

  class TextSaver(override var directory: String) extends DataSaver(directory) {

    def write(rdd: RDD[Int]) = {
      rdd.collect()

    }

  }

  def save(rdd: RDD[Int], format: String, directory: String) {

    format match {
      case "text" =>
        val saver = new TextSaver(directory)
      case "image" =>
        val saver = new ImageSaver(directory)
        saver.setColorMode("test")
    }


  }

}
{'fraction_non_alphanumeric': 0.10940499040307101, 'fraction_numerical': 0.0, 'mean_word_length': 2.8345588235294117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3424157', 'n_tokens_mistral': 348, 'n_tokens_neox': 327, 'n_words': 87}