<commit_before>require 'time'
require 'pathname'

require 'couchrest'
require 'active_support/inflector'

$:.unshift File.dirname(__FILE__)
require 'exegesis/document'
require 'exegesis/design'

module Exegesis
  
  def self.designs_directory= dir
    @designs_directory = Pathname.new(dir)
  end
  
  def self.designs_directory
    @designs_directory ||= Pathname.new(ENV["PWD"])
    @designs_directory
  end
  
  def self.design_file name
    File.read(designs_directory + name)
  end
  
  def self.database_template= template
    @db_template = template
  end
  
  def self.database_template
    @db_template ||= "http://localhost:5984/%s"
  end
  
  def self.database_for name
    database_template % name
  end
  
end<commit_msg>switch to autoload and the 'new singleton' method for Exegesis<commit_after>require 'time'
require 'pathname'

require 'couchrest'
require 'active_support/inflector'

$:.unshift File.dirname(__FILE__) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

module Exegesis
  autoload :Document,   'exegesis/document'
  autoload :Design,     'exegesis/design'
  
  extend self
  
  def designs_directory= dir
    @designs_directory = Pathname.new(dir)
  end
  
  def designs_directory
    @designs_directory ||= Pathname.new(ENV["PWD"])
    @designs_directory
  end
  
  def design_file name
    File.read(designs_directory + name)
  end
  
  def database_template= template
    @db_template = template
  end
  
  def database_template
    @db_template ||= "http://localhost:5984/%s"
  end
  
  def database_for name
    database_template % name
  end
  
  def document_classes
    @document_classes ||= Hash.new(Exegesis::Document)
  end
  
end
{'fraction_non_alphanumeric': 0.0975043528728961, 'fraction_numerical': 0.0046430644225188625, 'mean_word_length': 3.9257142857142857, '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': '5157191', 'n_tokens_mistral': 586, 'n_tokens_neox': 582, 'n_words': 124}