<commit_before>module MongoMapper
  module Extensions
    module Hash
      def from_mongo(value)
        value ||= {}
        value.make_indifferent!
      end
    end
  end
end

module IndifferentAccess
  def [](key)
    key = key.to_s
    super(key)
  end

  def []=(key,val)
    super(key.to_s,val)
  end

  def include?(key)
    super(key.to_s)
  end

  def delete(key)
    super(key.to_s)
  end

  def method_missing(sym,*args,&block)
    return self[sym.to_s[0..-2]] = args[0] if sym.to_s =~ /.*=$/
    return self[sym] if self.keys.include?(sym.to_s)
    nil
  end
end

class Hash
  extend MongoMapper::Extensions::Hash

  def make_indifferent!
    return self if defined?(@is_indifferent) && @is_indifferent

    stringify_keys!
    extend IndifferentAccess
    @is_indifferent = true

    self
  end
end
<commit_msg>Fixed a bug that caused a stack overflow in RPM<commit_after>module MongoMapper
  module Extensions
    module Hash
      def from_mongo(value)
        value ||= {}
        value.make_indifferent!
      end
    end
  end
end

module IndifferentAccess
  def [](key)
    key = key.to_s
    super(key)
  end

  def []=(key,val)
    super(key.to_s,val)
  end

  def include?(key)
    super(key.to_s)
  end

  def delete(key)
    super(key.to_s)
  end

  def method_missing(sym,*args,&block)
    return self[sym.to_s[0..-2]] = args[0] if sym.to_s =~ /.*=$/
    return self[sym] if self.keys.include?(sym.to_s)
    nil
  end
end

class Hash
  extend MongoMapper::Extensions::Hash

  def make_indifferent!
    return self if defined?(@is_indifferent) && @is_indifferent

    @is_indifferent = true
    stringify_keys!
    extend IndifferentAccess

    self
  end
end

{'fraction_non_alphanumeric': 0.10676156583629894, 'fraction_numerical': 0.0035587188612099642, 'mean_word_length': 2.782511210762332, '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': '5970166', 'n_tokens_mistral': 621, 'n_tokens_neox': 604, 'n_words': 143}