<commit_before>module Metrics

  IDENTIFIERS = [:completeness,
                 :weighted_completeness,
                 :richness_of_information,
                 :accuracy,
                 :accessibility,
                 :link_checker]

  NORMALIZE = [:richness_of_information,
               :accessibility]

  def self.normalize(metric, values)
    scores = []
    repositories = Repository.all
    repositories.each do |repository|
      score = repository.send(metric)
      unless score.nil?
        scores << score[:minimum]
        scores << score[:maximum]
      end
    end
    min = scores.min
    max = scores.max
    range = max - min
    values.map { |value| 100 * (value - min) / range }
  end

end<commit_msg>Do not normalize metric scores to percent<commit_after>module Metrics

  IDENTIFIERS = [:completeness,
                 :weighted_completeness,
                 :richness_of_information,
                 :accuracy,
                 :accessibility,
                 :link_checker]

  NORMALIZE = [:richness_of_information,
               :accessibility]

  def self.normalize(metric, values)

    unless NORMALIZE.include?(metric)
      return values
    end

    scores = []
    repositories = Repository.all
    repositories.each do |repository|
      score = repository.send(metric)
      unless score.nil?
        scores << score[:minimum]
        scores << score[:maximum]
      end
    end
    min = scores.min
    max = scores.max
    range = max - min
    values.map { |value| (value - min) / range }
  end

end
{'fraction_non_alphanumeric': 0.08861578266494179, 'fraction_numerical': 0.0019404915912031048, 'mean_word_length': 1.9243856332703213, 'pattern_counts': {'":': 0, '<': 11, '<?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': '1163722', 'n_tokens_mistral': 462, 'n_tokens_neox': 434, 'n_words': 101}