<commit_before>package com.eigengo.lift.util

import com.eigengo.lift.exercise._
import java.io._
import scodec.bits.BitVector

/**
 * Simple utility application for reading in raw binary accelerometer data, decoding it and then dumping it to a CSV file.
 */
object MultiPacketToCSV extends App {

  if (args.length != 2) {
    println("Usage: AccelerometerDataToCSV <input raw accelerometer binary filename> <output CSV filename>")
    sys.exit(1)
  }

  val inFileName = args(0)
  val outFileName = args(1)

  val decoderData = BitVector.fromMmap(new FileInputStream(new File(inFileName)).getChannel)

  val fd = new FileWriter(outFileName, true)
  try {
    fd.write("\"location\",\"samplingRate\",\"x\",\"y\",\"z\"\n")
    for (block <- MultiPacketDecoder.decode(decoderData.toByteBuffer)) {
      for (pkt <- block.packets) {
        for (data <- RootSensorDataDecoder(AccelerometerDataDecoder).decodeAll(pkt.payload)) {
          val csv = data.asInstanceOf[List[AccelerometerData]].flatMap { d => d.values.map(v => s"${pkt.sourceLocation},${d.samplingRate},${v.x},${v.y},${v.z}")}.mkString("", "\n", "\n")

          fd.write(csv)
        }
      }
    }
  } finally {
    fd.close()
  }

}
<commit_msg>Name change fix<commit_after>package com.eigengo.lift.util

import com.eigengo.lift.exercise._
import java.io._
import scodec.bits.BitVector

/**
 * Simple utility application for reading in raw binary accelerometer data, decoding it and then dumping it to a CSV file.
 */
object MultiPacketToCSV extends App {

  if (args.length != 2) {
    println("Usage: MultiPacketToCSV <input raw accelerometer binary filename> <output CSV filename>")
    sys.exit(1)
  }

  val inFileName = args(0)
  val outFileName = args(1)

  val decoderData = BitVector.fromMmap(new FileInputStream(new File(inFileName)).getChannel)

  val fd = new FileWriter(outFileName, true)
  try {
    fd.write("\"location\",\"samplingRate\",\"x\",\"y\",\"z\"\n")
    for (block <- MultiPacketDecoder.decode(decoderData.toByteBuffer)) {
      for (pkt <- block.packets) {
        for (data <- RootSensorDataDecoder(AccelerometerDataDecoder).decodeAll(pkt.payload)) {
          val csv = data.asInstanceOf[List[AccelerometerData]].flatMap { d => d.values.map(v => s"${pkt.sourceLocation},${d.samplingRate},${v.x},${v.y},${v.z}")}.mkString("", "\n", "\n")

          fd.write(csv)
        }
      }
    }
  } finally {
    fd.close()
  }

}

{'fraction_non_alphanumeric': 0.15480132450331127, 'fraction_numerical': 0.0033112582781456954, 'mean_word_length': 3.534709193245779, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '3874048', 'n_tokens_mistral': 825, 'n_tokens_neox': 788, 'n_words': 170}