<commit_before>
# Outputs the mean and median of the queried numbers.

if (!$type && $q_check =~ m/^(?:avg|average) {?([\-?0-9.,?;? ?]*)}?$/i) {
    # get an array of the entered numbers
    my @nums = split(m/(?:, ?| |; ?)/, $1);
    my $item;
    foreach $item (@nums) {
	$item =~ s/[;,]//g;
    }
    # initialize the sum
    my $sum = 0;
    # calculate the sum
    $sum += $_ for @nums;
    # get the length of the array
    my $len = @nums;
    # calculate the mean
    my $mean = $sum/$len;
    # sort the list numerically, least to greatest
    @nums = sort { $a <=> $b } @nums;
    my $med = 0;
    if ($len % 2 eq 0) {
	# get the two middle numbers, since the 
	# length is even, and calculate their mean
	$med = ($nums[$len/2] + $nums[$len/2-1])/2;
    }
    else {
	# get the middle number
	$med = $nums[int($len/2)]
    }
    # set the results
    $answer_results = qq(Mean: $mean\nMedian: $med);
    if ($answer_results) {
	$answer_type = 'average';
	$type = 'E';
    }
}<commit_msg>added root mean square/quadratic mean<commit_after>
# Outputs the mean and median of the queried numbers.

if (!$type && $q_check =~ m/^(?:avg|average) {?([\-?0-9.,?;? ?]*)}?$/i) {
    # get an array of the entered numbers
    my @nums = split(m/(?:, ?| |; ?)/, $1);
    my $item;
    foreach $item (@nums) {
	$item =~ s/[;,]//g;
    }
    # initialize the sum
    my $sum = 0;
    # calculate the sum
    $sum += $_ for @nums;
    # get the length of the array
    my $len = @nums;
    # calculate the mean
    my $mean = $sum/$len;
    # sort the list numerically, least to greatest
    @nums = sort { $a <=> $b } @nums;
    my $med = 0;
    if ($len % 2 eq 0) {
	# get the two middle numbers, since the 
	# length is even, and calculate their mean
	$med = ($nums[$len/2] + $nums[$len/2-1])/2;
    }
    else {
	# get the middle number
	$med = $nums[int($len/2)]
    }
    my $rms = 0;
    $rms += ($_ ** 2) for @nums;
    $rms /= $len;
    $rms = sqrt $rms;
    # set the results
    $answer_results = qq(Mean: $mean\nMedian: $med\nRoot Mean Square: $rms);
    if ($answer_results) {
	$answer_type = 'average';
	$type = 'E';
    }
}
{'fraction_non_alphanumeric': 0.18855534709193245, 'fraction_numerical': 0.012195121951219513, 'mean_word_length': 2.4458804523424877, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1499589', 'n_tokens_mistral': 859, 'n_tokens_neox': 834, 'n_words': 255}