<commit_before>module HashDiff
  class Comparison < Struct.new(:left, :right)
  
    def diff
      @diff ||= differences(left, right)
    end

    def left_diff
      @concern = :left
      @left_diff ||= differences(left, right)
    end

    def right_diff
      @concern = :right
      @right_diff ||= differences(left, right)
    end

    private

    def concern
      @concern ||= :both
    end

    def clone(left, right)
      self.dup.tap do |inst|
        inst.left  = left
        inst.right = right
      end
    end

    def differences(left, right)
      combined_attribute_keys.reduce({}, &reduction_strategy)
    end

    def reduction_strategy(opts={})<commit_msg>Update comparison.rb<commit_after>module HashDiff
  class Comparison < Struct.new(:left, :right)
  
    def diff
      @diff ||= differences(left, right)
    end

    def left_diff
      @concern = :left
      @left_diff ||= differences(left, right)
    end

    def right_diff
      @concern = :right
      @right_diff ||= differences(left, right)
    end

    private

    def concern
      @concern ||= :both
    end

    def clone(left, right)
      self.dup.tap do |inst|
        inst.left  = left
        inst.right = right
      end
    end

    def differences(left, right)
      combined_attribute_keys.reduce({}, &reduction_strategy)
    end

    def reduction_strategy
{'fraction_non_alphanumeric': 0.09705882352941177, 'fraction_numerical': 0.0, 'mean_word_length': 2.26378896882494, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6482579', 'n_tokens_mistral': 436, 'n_tokens_neox': 417, 'n_words': 108}