<commit_before><commit_msg>Update task2.rb<commit_after>require 'csv'

my = [[],[]]
my = CSV.read (ARGV[0])
wanted = ARGV[1].to_s
a = my.to_s.gsub(/\W/,'')

counter = 0
my.each.with_index do |row,i| 
	#if is at one line
	if (my[i].to_s.downcase.gsub(/\W/,'')).include?(wanted)
		counter = counter + 1
	elsif my[i].to_s.downcase.gsub(/\W/,'').reverse.include?(wanted)
		counter = counter + 1
	end
	
	row.each.with_index do |cell, j|
	     if (i..j).collect { |i| my[i][i] }.to_s.gsub(/[\W]/,'').include?(wanted)
	          counter = counter + 1
	     elsif ((i..j).collect { |i| my[i][i] }.to_s.gsub(/[\W]/,'').reverse.include?(wanted))
		     counter = counter + 1
	     end
          		#puts my[i][j].to_s.downcase.gsub(/\W/,'')
          		#if (my[i][j].to_s.downcase.gsub(/\W/,'')).include?(wanted)
				#	counter = counter + 1
				#elsif my[i][j].to_s.downcase.gsub(/\W/,'').reverse.include?(wanted)
				#	counter = counter + 1
       		     #end
end
end


puts counter
#dava mi samo diagonala 0,0 1,1 2,2 3,3 
          	#	b = (i..j).collect { |i| my[i][i] }.to_s.gsub(/[\W]/,'')
          	#	puts b
          	#	puts
{'fraction_non_alphanumeric': 0.22836752899197146, 'fraction_numerical': 0.016057091882247992, 'mean_word_length': 2.462962962962963, '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': '616392', 'n_tokens_mistral': 523, 'n_tokens_neox': 486, 'n_words': 86}