<commit_before>package readme

import java.io.{InputStreamReader, BufferedReader}

import ammonite.ops._
import scala.collection.mutable
import scalatags.Text.all._

object Sample{
  val replCurl = "$ curl -L -o amm http://git.io/vZJoU; chmod +x amm; ./amm"
  val filesystemCurl =
    "$ mkdir ~/.ammonite; curl -L -o ~/.ammonite/predef.scala http://git.io/vZJot"
  val cacheVersion = 5
  def cached(key: Any)(calc: => String) = {
    val path = cwd/'target/'cache/(key.hashCode + cacheVersion).toString
    try read! path
    catch{ case e =>
      val newValue = calc
      write.over(path, newValue)
      newValue
    }
  }

  val ansiRegex = "\u001B\\[[;\\d]*."
  def ammSample(ammoniteCode: String) = {
    val scalaVersion = scala.util.Properties.versionNumberString
    val ammVersion = ammonite.Constants.version
    val executableName = s"ammonite-repl-$ammVersion-$scalaVersion"
    val ammExec = "repl/target/scala-2.11/" + executableName
    val predef = "shell/src/main/resources/example-predef.scala"
    val out = exec(Seq(ammExec, "--predef-file", predef), s"${ammoniteCode.trim}\nexit\n")
    val lines = out.lines.toSeq.drop(3).dropRight(2).mkString("\n")
//    println("ammSample " + lines)
    val ammOutput = lines.split("\u001b")

    val red = "#c0392b"
    val green = "#27ae60"
    val yellow = "#f39c12"
    val blue = "#2980b9"
    val magenta = "#8e44ad"
    val cyan = "#16a085"<commit_msg>update download link<commit_after>package readme

import java.io.{InputStreamReader, BufferedReader}

import ammonite.ops._
import scala.collection.mutable
import scalatags.Text.all._

object Sample{
  val replCurl = "$ curl -L -o amm http://git.io/vnnBX; chmod +x amm; ./amm"
  val filesystemCurl =
    "$ mkdir ~/.ammonite; curl -L -o ~/.ammonite/predef.scala http://git.io/vnnBy"
  val cacheVersion = 5
  def cached(key: Any)(calc: => String) = {
    val path = cwd/'target/'cache/(key.hashCode + cacheVersion).toString
    try read! path
    catch{ case e =>
      val newValue = calc
      write.over(path, newValue)
      newValue
    }
  }

  val ansiRegex = "\u001B\\[[;\\d]*."
  def ammSample(ammoniteCode: String) = {
    val scalaVersion = scala.util.Properties.versionNumberString
    val ammVersion = ammonite.Constants.version
    val executableName = s"ammonite-repl-$ammVersion-$scalaVersion"
    val ammExec = "repl/target/scala-2.11/" + executableName
    val predef = "shell/src/main/resources/example-predef.scala"
    val out = exec(Seq(ammExec, "--predef-file", predef), s"${ammoniteCode.trim}\nexit\n")
    val lines = out.lines.toSeq.drop(3).dropRight(2).mkString("\n")
//    println("ammSample " + lines)
    val ammOutput = lines.split("\u001b")

    val red = "#c0392b"
    val green = "#27ae60"
    val yellow = "#f39c12"
    val blue = "#2980b9"
    val magenta = "#8e44ad"
    val cyan = "#16a085"
{'fraction_non_alphanumeric': 0.14822620302072356, 'fraction_numerical': 0.02599227256761503, 'mean_word_length': 3.219259259259259, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '191182', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1015, 'n_words': 221}