<commit_before>require 'bundler/setup'
require 'sinatra'
require 'haml'
require 'sass'
require 'ostruct'
require 'yaml'
require 'active_record'
require 'logger'
require 'name-spotter'
require 'uri'
require 'tmpdir'
require 'mechanize'
require 'docsplit'
require 'resque'
require 'rack/google-analytics'
require 'digest/sha1'

#set environment
environment = ENV["RACK_ENV"] || ENV["RAILS_ENV"]
environment = (environment && ["production", "test", "development"].include?(environment.downcase)) ? environment.downcase.to_sym : :development
Sinatra::Base.environment = environment

#set encoding
Encoding.default_external = "UTF-8"

#configure
root_path = File.expand_path(File.dirname(__FILE__))
conf = YAML.load(open(File.join(root_path, 'config.yml')).read)[Sinatra::Base.environment.to_s]
configure do
  SiteConfig = OpenStruct.new(
                 :title => 'Global Names Recognition and Discovery',
                 :url_base => conf.delete('url_base'),
                 :root_path => root_path,
                 :salt => conf.delete('salt'),
                 :disqus_shortname => 'globalnames-rd',
               )

  # to see sql during tests uncomment next line
  ActiveRecord::Base.logger = Logger.new(STDOUT, :debug)
  ActiveRecord::Base.establish_connection(conf)
  # ActiveRecord::Base.schema_format = :sql

  # load models
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib', 'gnrd'))
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'models'))
  Dir.glob(File.join(File.dirname(__FILE__), 'lib', '**', '*.rb')) { |lib|   require File.basename(lib, '.*') }
  Dir.glob(File.join(File.dirname(__FILE__), 'models', '*.rb')) { |model| require File.basename(model, '.*') }
end

#production-specific
if environment == "production"
  site_specific_file =  File.join(File.dirname(__FILE__), 'config', 'production_site_specific')
  require site_specific_file if File.exists?(site_specific_file + ".rb")
end
<commit_msg>Fixed dumb bug in including production-specific config script<commit_after>require 'bundler/setup'
require 'sinatra'
require 'haml'
require 'sass'
require 'ostruct'
require 'yaml'
require 'active_record'
require 'logger'
require 'name-spotter'
require 'uri'
require 'tmpdir'
require 'mechanize'
require 'docsplit'
require 'resque'
require 'rack/google-analytics'
require 'digest/sha1'

#set environment
environment = ENV["RACK_ENV"] || ENV["RAILS_ENV"]
environment = (environment && ["production", "test", "development"].include?(environment.downcase)) ? environment.downcase.to_sym : :development
Sinatra::Base.environment = environment

#set encoding
Encoding.default_external = "UTF-8"

#configure
root_path = File.expand_path(File.dirname(__FILE__))
conf = YAML.load(open(File.join(root_path, 'config.yml')).read)[Sinatra::Base.environment.to_s]
configure do
  SiteConfig = OpenStruct.new(
                 :title => 'Global Names Recognition and Discovery',
                 :url_base => conf.delete('url_base'),
                 :root_path => root_path,
                 :salt => conf.delete('salt'),
                 :disqus_shortname => 'globalnames-rd',
               )

  # to see sql during tests uncomment next line
  ActiveRecord::Base.logger = Logger.new(STDOUT, :debug)
  ActiveRecord::Base.establish_connection(conf)
  # ActiveRecord::Base.schema_format = :sql

  # load models
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib', 'gnrd'))
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'models'))
  Dir.glob(File.join(File.dirname(__FILE__), 'lib', '**', '*.rb')) { |lib|   require File.basename(lib, '.*') }
  Dir.glob(File.join(File.dirname(__FILE__), 'models', '*.rb')) { |model| require File.basename(model, '.*') }
end

#production-specific
if environment == :production
  site_specific_file =  File.join(File.dirname(__FILE__), 'config', 'production_site_specific')
  require site_specific_file if File.exists?(site_specific_file + ".rb")
end

{'fraction_non_alphanumeric': 0.15221151470224858, 'fraction_numerical': 0.0009883864591055103, 'mean_word_length': 4.791130185979972, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '55081', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1276, 'n_words': 255}