<commit_before>require 'find'
require 'fileutils'

def convert_image(original, out, image_opts)
	new_name = original.sub '_raw_img', out
	new_dir = File.dirname(new_name)
	unless File.directory?(new_dir)
		puts "creating #{new_dir}"
		FileUtils.mkdir_p(new_dir)
	end

	if File.file?(new_name) 
		puts "Skipping #{original}, #{new_name} already exists"
	else 
		cmd = "convert #{original} #{image_opts} #{new_name}"
		puts "converting with #{image_opts} #{original}-->#{new_name}"
		system cmd
	end
end

def convert(file)
	if (!File.directory?(file) && file[".jpg"])
		convert_image(file, "img", "-resize 750 -strip -quality 86")
		convert_image(file, "img/thumbnail", "-resize 200 -strip -quality 86")
	end
end

Find.find('../_raw_img') { |e| convert e}<commit_msg>Remove unneeded parentheses (Ruby style :D)<commit_after>require 'find'
require 'fileutils'

def convert_image(original, out, image_opts)
	new_name = original.sub '_raw_img', out
	new_dir = File.dirname(new_name)
	unless File.directory?(new_dir)
		puts "creating #{new_dir}"
		FileUtils.mkdir_p(new_dir)
	end

	if File.file?(new_name)
		puts "Skipping #{original}, #{new_name} already exists"
	else
		cmd = "convert #{original} #{image_opts} #{new_name}"
		puts "converting with #{image_opts} #{original}-->#{new_name}"
		system cmd
	end
end

def convert(file)
	if File.file?(file) && file.end_with?(".jpg")
		convert_image(file, "img", "-resize 750 -strip -quality 86")
		convert_image(file, "img/thumbnail", "-resize 200 -strip -quality 86")
	end
end

Find.find('../_raw_img') { |e| convert e}
{'fraction_non_alphanumeric': 0.1576923076923077, 'fraction_numerical': 0.01282051282051282, 'mean_word_length': 5.169960474308301, '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': '1312558', 'n_tokens_mistral': 610, 'n_tokens_neox': 566, 'n_words': 142}