<commit_before>module Sequel

  class Dataset

    def insert_from(data)
      data = data.to_h unless data.is_a? Hash
      insert data.select { |k, v| columns.include? k }
    end

    def as(cls)
      to_a.map do |row|
        values = cls.members.map { |k| row[k] }
        cls.new(*values)
      end
    end

  end
end
<commit_msg>sequel: Dataset#single_row for fetching single row from a database<commit_after>module Sequel

  class Dataset

    def insert_from(data)
      data = data.to_h unless data.is_a? Hash
      insert data.select { |k, v| columns.include? k }
    end

    def as(cls)
      to_a.map do |row|
        values = cls.members.map { |k| row[k] }
        cls.new(*values)
      end
    end

    def single_row(column = 0)
      map { |row| row[column] }
    end

  end
end

{'fraction_non_alphanumeric': 0.10137672090112641, 'fraction_numerical': 0.0012515644555694619, 'mean_word_length': 2.1496062992125986, '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': '3915903', 'n_tokens_mistral': 291, 'n_tokens_neox': 282, 'n_words': 79}