<commit_before><commit_msg>Add HetsOptions class<commit_after>module Hets
  class HetsOptions
    attr_reader :options

    def self.from_hash(hash)
      new(hash['options'])
    end

    def initialize(opts = {})
      @options = opts.dup
      prepare
    end

    def add(**opts)
      @options.merge!(opts.dup)
      prepare
    end

    protected

    def prepare
      remove_nil_fields
      prepare_url_catalog
    end

    def remove_nil_fields
      nil_valued_keys = @options.keys.select { |key| @options[key].nil? }
      nil_valued_keys.each { |key| @options.delete(key) }
    end

    def prepare_url_catalog
      @options[:'url-catalog'].try(:compact!)
      if @options[:'url-catalog'].blank?
        @options.delete(:'url-catalog')
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10925449871465295, 'fraction_numerical': 0.0, 'mean_word_length': 2.557077625570776, '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': '6684793', 'n_tokens_mistral': 255, 'n_tokens_neox': 244, 'n_words': 49}