<commit_before>require 'yaml'
require 'active_support'
require 'active_support/core_ext'
require 'photish/default_config'

module Photish
  class Config
    def initialize(config_file_path)
      @config_file_path = config_file_path
      @config = DefaultConfig.hash 
      override!(config_file_hash)
    end

    def val(key)
      @config[key.to_sym]
    end

    def override!(hash)
      @config.merge!(clean(hash))
    end

    private

    attr_reader :config_file_path

    def config_file_hash
      clean(YAML.load_file(config_file_path))
    end

    def clean(hash)
      hash.compact.deep_symbolize_keys<commit_msg>whitespace<commit_after>require 'yaml'
require 'active_support'
require 'active_support/core_ext'
require 'photish/default_config'

module Photish
  class Config
    def initialize(config_file_path)
      @config_file_path = config_file_path
      @config = DefaultConfig.hash
      override!(config_file_hash)
    end

    def val(key)
      @config[key.to_sym]
    end

    def override!(hash)
      @config.merge!(clean(hash))
    end

    private

    attr_reader :config_file_path

    def config_file_hash
      clean(YAML.load_file(config_file_path))
    end

    def clean(hash)
      hash.compact.deep_symbolize_keys
{'fraction_non_alphanumeric': 0.07814992025518341, 'fraction_numerical': 0.0, 'mean_word_length': 3.388111888111888, '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': '7352384', 'n_tokens_mistral': 420, 'n_tokens_neox': 400, 'n_words': 75}