<commit_before>module Saxaphone
  class Util
    class << self
      def constantize(camel_cased_word)
        names = camel_cased_word.split('::')
        names.shift if names.empty? || names.first.empty?

        constant = Object
        names.each do |name|
          constant = constant.const_defined?(name, false) ? constant.const_get(name) : constant.const_missing(name)
        end
        constant
      end
    end
  end
end<commit_msg>support ruby 1.8.7 version of const_defined<commit_after>module Saxaphone
  class Util
    class << self
      def constantize(camel_cased_word)
        names = camel_cased_word.split('::')
        names.shift if names.empty? || names.first.empty?

        constant = Object
        names.each do |name|
          constant = standardized_const_defined?(constant, name) ? constant.const_get(name) : constant.const_missing(name)
        end
        constant
      end

      if Module.method(:const_defined?).arity == 1
        def standardized_const_defined?(constant, name)
          constant.const_defined?(name)
        end
      else
        def standardized_const_defined?(constant, name)
          constant.const_defined?(name, false)
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08816326530612245, 'fraction_numerical': 0.0032653061224489797, 'mean_word_length': 2.453521126760563, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7181904', 'n_tokens_mistral': 358, 'n_tokens_neox': 351, 'n_words': 80}