<commit_before>require 'addressable/uri'
require 'forwardable'
require 'memoizable'

module Enumerable
  def to_h(*arg)
    h = {}
    each_with_index(*arg) do |elem, i|
      unless elem.respond_to?(:to_ary)
        raise TypeError, "wrong element type #{elem.class} at #{i} (expected array)"
      end

      ary = elem.to_ary
      if ary.size != 2
        raise ArgumentError, "wrong array length at #{i} (expected 2, was #{ary.size})"
      end

      h[ary[0]] = ary[1]
    end
    h
  end
end

module Taxjar
  class Base
    extend Forwardable<commit_msg>check if to_h is already defined and leave it alone if it's already there<commit_after>require 'addressable/uri'
require 'forwardable'
require 'memoizable'

if !Array.new.respond_to?(:to_h)
  module Enumerable
    def to_h(*arg)
      h = {}
      each_with_index(*arg) do |elem, i|
        unless elem.respond_to?(:to_ary)
          raise TypeError, "wrong element type #{elem.class} at #{i} (expected array)"
        end

        ary = elem.to_ary
        if ary.size != 2
          raise ArgumentError, "wrong array length at #{i} (expected 2, was #{ary.size})"
        end

        h[ary[0]] = ary[1]
      end
      h
    end
  end
end

module Taxjar
  class Base
    extend Forwardable
{'fraction_non_alphanumeric': 0.10853950518754989, 'fraction_numerical': 0.006384676775738229, 'mean_word_length': 2.5931232091690544, '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': '7275876', 'n_tokens_mistral': 432, 'n_tokens_neox': 412, 'n_words': 129}