<commit_before>package ru.katas.n4

import ru.util.Arcade

/**
 * User: dima
 * Date: 24/06/2012
 */

@Arcade
class DataMunging2 {

}<commit_msg>data munging kata @acrade<commit_after>package ru.katas.n4

import ru.util.Arcade
import org.junit.Test
import scala.io.Source

/**
 * User: dima
 * Date: 24/06/2012
 */

@Arcade
class DataMunging2 {
	@Test def aaa() {
		println(
			findMinRow("/Users/dima/IdeaProjects/katas/src/main/scala/ru/katas/n4/weather.dat", 1, 2, 3)
		)
		println(
			Source.fromFile("/Users/dima/IdeaProjects/katas/src/main/scala/ru/katas/n4/football.dat").getLines().toSeq.filter(_.matches(" +\\d+.*"))
				.map(_.replace("*", "").split(" +")).map{row => (row(2), (row(7).toInt - row(9).toInt).abs)}.minBy(_._2)
		)
	}

	def findMinRow(fileName: String, idCol: Int, minCol: Int, maxCol: Int): (String, Int) = {
		Source.fromFile(fileName).getLines().toSeq.filter(_.matches(" +\\d+.*"))
			.map(_.replace("*", "").split(" +")).map {
			row => (row(idCol), (row(minCol).toInt - row(maxCol).toInt).abs)
		}.minBy(_._2)
	}
}
{'fraction_non_alphanumeric': 0.2214765100671141, 'fraction_numerical': 0.028763183125599234, 'mean_word_length': 3.8333333333333335, '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': '816267', 'n_tokens_mistral': 477, 'n_tokens_neox': 438, 'n_words': 67}