<commit_before>module Questions # :nodoc: all

	module Changesets

		def total_changesets_created
			{"Number of Changesets" => aw.changeset_count}
		end

		def changesets_per_mapper
			changesets_by_uid = aw.changesets_x_all.first[:objects].group_by{|changeset| changeset.uid}
		end

		def mean_changesets_per_mapper
			num_changesets = changesets_per_mapper.collect{|uid, changesets| changesets.length}
			{"Mean Changesets Per Mapper" => DescriptiveStatistics.mean(num_changesets) }
		end

		def median_changesets_per_mapper
			num_changesets = changesets_per_mapper.collect{|uid, changesets| changesets.length}
			{"Median Changesets Per Mapper" => DescriptiveStatistics.median(num_changesets) }
		end

		def number_of_changesets_by_new_mappers
			changesets_by_new_mappers = Changeset_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.new_contributors}}).run
			{'Number of Changesets by New Mappers' => changesets_by_new_mappers.first[:objects].length }
		end

		def number_of_changesets_by_experienced_mappers
			changesets_by_experienced_mappers = Changeset_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.experienced_contributors}}).run
			{'Number of Changesets by Experienced Mappers' => changesets_by_experienced_mappers.first[:objects].length }
		end

    def number_of_changesets_per_tag
      changesets_per_tag = []
      tags = aw.changeset_tags.split(" ")
      tags.each do |tag|<commit_msg>adding changeset counts per mapper<commit_after>module Questions # :nodoc: all

	module Changesets

		def total_changesets_created
			{"Number of Changesets" => aw.changeset_count}
		end

		def changesets_per_mapper
			changesets_by_uid = aw.changesets_x_all.first[:objects].group_by{|changeset| changeset.uid}
		end

		def number_of_changesets_per_mapper
			changesets_by_uid = aw.changesets_x_all.first[:objects].group_by{|changeset| changeset.user}
			changeset_counts = {}
			changesets_by_uid.each do |user, changesets|
				changeset_counts[user] = changesets.count
			end
			changeset_counts
		end

		def mean_changesets_per_mapper
			num_changesets = changesets_per_mapper.collect{|uid, changesets| changesets.length}
			{"Mean Changesets Per Mapper" => DescriptiveStatistics.mean(num_changesets) }
		end

		def median_changesets_per_mapper
			num_changesets = changesets_per_mapper.collect{|uid, changesets| changesets.length}
			{"Median Changesets Per Mapper" => DescriptiveStatistics.median(num_changesets) }
		end

		def number_of_changesets_by_new_mappers
			changesets_by_new_mappers = Changeset_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.new_contributors}}).run
			{'Number of Changesets by New Mappers' => changesets_by_new_mappers.first[:objects].length }
		end

		def number_of_changesets_by_experienced_mappers
			changesets_by_experienced_mappers = Changeset_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.experienced_contributors}}).run
			{'Number of Changesets by Experienced Mappers' => changesets_by_experienced_mappers.first[:objects].length }
		end

    def number_of_changesets_per_tag
      changesets_per_tag = []
      tags = aw.changeset_tags.split(" ")
      tags.each do |tag|
{'fraction_non_alphanumeric': 0.09332084893882647, 'fraction_numerical': 0.0, 'mean_word_length': 5.594650205761317, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3856663', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1031, 'n_words': 188}