<commit_before>class Array

	def sum
		return inject { |sum, n| sum + n }
	end

	def mean
		return sum.to_f/size
	end

	alias :average :mean

end<commit_msg>Add Array.range, Array.median, and Array.occurences<commit_after>class Array

	def sum
		return inject { |sum, n| sum + n }
	end

	def range
		max - min
	end

	def mean
		return sum.to_f/size
	end

	def median
		sorted = sort
		if sorted.length.odd?
			self[length/2]
		else
			(self[length/2-1] + self[length/2]) / 2.0
		end
	end

	def occurences
		occurences = {}
		self.each { |item| occurences[item] = 0 }
		self.each { |item| occurences[item] += 1 }
		occurences
	end

	alias :average :mean

end
{'fraction_non_alphanumeric': 0.1080669710806697, 'fraction_numerical': 0.0121765601217656, 'mean_word_length': 2.893491124260355, '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': '5956423', 'n_tokens_mistral': 290, 'n_tokens_neox': 257, 'n_words': 74}