<commit_before>module Tyche
  module Core
    ##
    # Gets user's options from a configuration file.
    class Configuration
      attr_reader :options

      def initialize(path, loader = YAML)
        @path = path
        @options = {}
        @loader = loader
      end

      def load
        @options = @loader.load_file(expand_path)
      end

      private

      def expand_path
        File.dirname($PROGRAM_NAME) + '/' + @path
      end
    end
  end
end
<commit_msg>Exit when the configuration file not exists<commit_after>module Tyche
  module Core
    ##
    # Gets user's options from a configuration file.
    class Configuration
      attr_reader :options

      def initialize(path, loader = YAML)
        @path = path
        @options = {}
        @loader = loader
      end

      def load
        @options = @loader.load_file(expand_path)
      rescue Errno::ENOENT
        $stderr.puts "Unable to find '#{expand_path}': missing configuration file"
        exit(1)
      end

      private

      def expand_path
        File.dirname($PROGRAM_NAME) + '/' + @path
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.07913669064748201, 'fraction_numerical': 0.0008992805755395684, 'mean_word_length': 1.9839142091152815, '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': '3844841', 'n_tokens_mistral': 327, 'n_tokens_neox': 313, 'n_words': 95}