<commit_before>require 'benchmark'
require './lib/psd'

psd = nil
file = ARGV[0] || 'examples/images/example.psd'
results = Benchmark.measure "PSD parsing" do
  psd = PSD.new(file)
  psd.parse!
end

# puts "\nVisible Layers:\n===================="
# psd.layers.each do |layer|
#   next if layer.folder? || layer.hidden?

#   puts "Name: #{layer.name}"
#   puts "Position: top = #{layer.top}, left = #{layer.left}"
#   puts "Size: width = #{layer.width}, height = #{layer.height}"
#   puts "Mask: width = #{layer.mask.width}, height = #{layer.mask.height}"
#   puts "Reference point: #{layer.ref_x}, #{layer.ref_y}"

#   puts ""
# end

# puts "\nPSD Info:\n===================="
# puts "#{psd.width}x#{psd.height} #{psd.header.mode_name}"
# puts "#{psd.resources.size} resources parsed"
# puts "#{psd.layers.size} layers, #{psd.folders.size} folders"

# puts "\nBenchmark Results (seconds):\n===================="
# puts " "*7 + Benchmark::CAPTION
# puts "parse: " + results.to_s<commit_msg>Uncomment code from example<commit_after>require 'benchmark'
require './lib/psd'

psd = nil
file = ARGV[0] || 'examples/images/example.psd'
results = Benchmark.measure "PSD parsing" do
  psd = PSD.new(file)
  psd.parse!
end

puts "\nVisible Layers:\n===================="
psd.layers.each do |layer|
  next if layer.folder? || layer.hidden?

  puts "Name: #{layer.name}"
  puts "Position: top = #{layer.top}, left = #{layer.left}"
  puts "Size: width = #{layer.width}, height = #{layer.height}"
  puts "Mask: width = #{layer.mask.width}, height = #{layer.mask.height}"
  puts "Reference point: #{layer.ref_x}, #{layer.ref_y}"

  puts ""
end

puts "\nPSD Info:\n===================="
puts "#{psd.width}x#{psd.height} #{psd.header.mode_name}"
puts "#{psd.resources.size} resources parsed"
puts "#{psd.layers.size} layers, #{psd.folders.size} folders"

puts "\nBenchmark Results (seconds):\n===================="
puts " "*7 + Benchmark::CAPTION
puts "parse: " + results.to_s
{'fraction_non_alphanumeric': 0.2423469387755102, 'fraction_numerical': 0.0020408163265306124, 'mean_word_length': 4.684057971014493, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2048880', 'n_tokens_mistral': 718, 'n_tokens_neox': 711, 'n_words': 164}