<commit_before>module MaterializedViews

  def gold_standard_test(views)
    result = ''
    views.each { |view| result << GoldStandardTest.new(view).result }
    result
  end

  def list
    all_views = ActiveRecord::Base.connection.query('SELECT viewname
                                                     FROM pg_views
                                                     WHERE schemaname = ANY (current_schemas(false))',
                                                     'SCHEMA').map { |row| row[0] }
    all_views.keep_if { |view| view.end_with? '_unmaterialized' }
  end

  class GoldStandardTest

    def initialize(unmaterialized_name)
      @unm_name = unmaterialized_name
      @unm      = unmaterialized_class
      @mat_name = materialized_name
      @mat      = materialized_class
      @primary_key = @mat.primary_key
    end

    def result
      result = "\n\n\n{@mat}\n"
      result += total_count_check
      result += row_comparison<commit_msg>more tweaking<commit_after>module MaterializedViews

  def self.gold_standard_test(views)
    result = ''
    views.each { |view| result << GoldStandardTest.new(view).result }
    result
  end

  def self.list
    all_views = ActiveRecord::Base.connection.query('SELECT viewname
                                                     FROM pg_views
                                                     WHERE schemaname = ANY (current_schemas(false))',
                                                     'SCHEMA').map { |row| row[0] }
    all_views.keep_if { |view| view.end_with? '_unmaterialized' }
  end

  class GoldStandardTest

    def initialize(unmaterialized_name)
      @unm_name = unmaterialized_name
      @unm      = unmaterialized_class
      @mat_name = materialized_name
      @mat      = materialized_class
      @primary_key = @mat.primary_key
    end

    def result
      result = "\n\n\n{@mat}\n"
      result += total_count_check
      result += row_comparison
{'fraction_non_alphanumeric': 0.08307692307692308, 'fraction_numerical': 0.0010256410256410256, 'mean_word_length': 1.7871428571428571, 'pattern_counts': {'":': 0, '<': 7, '<?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': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2357361', 'n_tokens_mistral': 533, 'n_tokens_neox': 518, 'n_words': 106}