<commit_before>module Baler
  module Support
    module Hash
      def compose(other_hash)
        new_hash = self.clone
        new_hash.each{|key, value| new_hash[key] = other_hash[value]}
      end
    end
    
    module Array
      def extract_options
        last.is_a?(Hash) ? pop : {}
      end<commit_msg>Adding a hash method #extract_with_defaults<commit_after>module Baler
  module Support
    module Hash
      def compose(other_hash)
        new_hash = self.clone
        new_hash.each{|key, value| new_hash[key] = other_hash[value]}
      end
      
      def extract_with_defaults!(defaults)
        new_hash = {}
        self.keys.each do |key|
          if defaults.keys.include? key
            new_hash[key] = self.delete key
          end
        end
        defaults.merge new_hash
      end
    end
    
    module Array
      def extract_options
        last.is_a?(Hash) ? pop : {}
      end
{'fraction_non_alphanumeric': 0.07768052516411379, 'fraction_numerical': 0.0, 'mean_word_length': 1.9707792207792207, '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': '7420373', 'n_tokens_mistral': 280, 'n_tokens_neox': 276, 'n_words': 66}