<commit_before>module OptimusPrime
  class Source
    attr_accessor :columns, :index_of_column, :data
    
    def initialize(columns)
      raise "columns parameter must be an Hash!" unless columns.is_a? Hash
      @index_of_column = columns.keys
      @columns = columns
    end

    def retrieve_data
      implement_retrieve_data
      check_column
      @data
    end

    def column_to_index(columns)
      index_by_request = Array.new
      hash = Hash[@index_of_column.map.with_index.to_a]
      columns.each do |column|
        raise "column #{column} not found" if hash[column].nil?
        index_by_request.push hash[column]
      end
      index_by_request
    end

    protected

    def implement_retrieve_data
      raise "The 'retrieve_data' method is not defined in subclass! Please define before continuing."
    end

    private

    def check_column
      raise "expect #{@columns.count} columns, but received #{@data.first.count}" if @columns.count != @data.first.count
    end

  end
end
<commit_msg>pluralizing check_column method<commit_after>module OptimusPrime
  class Source
    attr_accessor :columns, :index_of_column, :data
    
    def initialize(columns)
      raise "columns parameter must be an Hash!" unless columns.is_a? Hash
      @index_of_column = columns.keys
      @columns = columns
    end

    def retrieve_data
      implement_retrieve_data
      check_columns
      @data
    end

    def column_to_index(columns)
      index_by_request = Array.new
      hash = Hash[@index_of_column.map.with_index.to_a]
      columns.each do |column|
        raise "column #{column} not found" if hash[column].nil?
        index_by_request.push hash[column]
      end
      index_by_request
    end

    protected

    def implement_retrieve_data
      raise "The 'retrieve_data' method is not defined in subclass! Please define before continuing."
    end

    private

    def check_columns
      raise "expect #{@columns.count} columns, but received #{@data.first.count}" if @columns.count != @data.first.count
    end

  end
end

{'fraction_non_alphanumeric': 0.07170542635658915, 'fraction_numerical': 0.0, 'mean_word_length': 2.831168831168831, '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': '4596837', 'n_tokens_mistral': 619, 'n_tokens_neox': 602, 'n_words': 172}