<commit_before>require 'faker'
require 'securerandom'

class TestModel
  @collection = Hash.new

  def self.collection
    @collection
  end

  def self.clear
    @collection.clear
  end

  def self.find_by_id(id)
    collection.fetch(id)
  end

  def self.register(key, value)
    collection[key] = value
  end

  def self.populate(count)
    count.times do
      o = new
      register(o.id, o)
    end
  end

  attr_reader :id
  attr_reader :date
  attr_reader :color
  attr_reader :department
  attr_reader :email
  attr_reader :name
  attr_reader :words

  def initialize
    @id         = SecureRandom.uuid
    @date       = ::Faker::Date.backward(365)
    @color      = ::Faker::Commerce.color
    @department = ::Faker::Commerce.department
    @email      = ::Faker::Internet.free_email
    @name       = ::Faker::Name.name
    @words      = ::Faker::Hipster.paragraph
  end

  def thinsearch_facets
    { :date => date, :color => color, :department => department }
  end

  def thinsearch_important
    [ email, name ]
  end

  def thinsearch_normal
    words
  end
end<commit_msg>allow setting model fields for testing<commit_after>require 'faker'
require 'securerandom'

class TestModel
  @collection = Hash.new

  def self.collection
    @collection
  end

  def self.clear
    @collection.clear
  end

  def self.find_by_id(id)
    collection.fetch(id)
  end

  def self.register(key, value)
    collection[key] = value
  end

  def self.populate(count)
    count.times do
      o = new
      register(o.id, o)
    end
  end

  attr_reader :id
  attr_accessor :date
  attr_accessor :color
  attr_accessor :department
  attr_accessor :email
  attr_accessor :name
  attr_accessor :words

  def initialize
    @id         = SecureRandom.uuid
    @date       = ::Faker::Date.backward(365)
    @color      = ::Faker::Commerce.color
    @department = ::Faker::Commerce.department
    @email      = ::Faker::Internet.free_email
    @name       = ::Faker::Name.name
    @words      = ::Faker::Hipster.paragraph
  end

  def thinsearch_facets
    { :date => date, :color => color, :department => department }
  end

  def thinsearch_important
    [ email, name ]
  end

  def thinsearch_normal
    words
  end
end
{'fraction_non_alphanumeric': 0.09652683806946324, 'fraction_numerical': 0.0027063599458728013, 'mean_word_length': 2.7466216216216215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4582123', 'n_tokens_mistral': 774, 'n_tokens_neox': 735, 'n_words': 176}