<commit_before>require "sapience"

module Sapience
  class Rails < ::Rails::Engine

    # Replace Rails logger initializer
    Rails::Application::Bootstrap.initializers.delete_if { |i| i.name == :initialize_logger }

    initializer :initialize_logger, group: :all do
      Sapience.configure
      ::Rails.logger = Sapience[::Rails]
      [:active_record, :action_controller, :action_mailer, :action_view].each do |name|
        ActiveSupport.on_load(name) { include Sapience::Loggable }
      end
      ActiveSupport.on_load(:action_cable) { self.logger = Sapience["ActionCable"] }
    end

    # Before any initializers run, but after the gems have been loaded
    config.before_initialize do
      # Replace the Mongoid Logger
      Mongoid.logger              = Sapience[Mongoid] if defined?(Mongoid)
      Moped.logger                = Sapience[Moped] if defined?(Moped)

      # Replace the Resque Logger
      Resque.logger               = Sapience[Resque] if defined?(Resque) && Resque.respond_to?(:logger)
<commit_msg>Avoid clashing with current class<commit_after>require "sapience"

module Sapience
  class Rails < ::Rails::Engine

    # Replace Rails logger initializer
    ::Rails::Application::Bootstrap.initializers.delete_if { |i| i.name == :initialize_logger }

    initializer :initialize_logger, group: :all do
      Sapience.configure
      ::Rails.logger = Sapience[::Rails]
      [:active_record, :action_controller, :action_mailer, :action_view].each do |name|
        ActiveSupport.on_load(name) { include Sapience::Loggable }
      end
      ActiveSupport.on_load(:action_cable) { self.logger = Sapience["ActionCable"] }
    end

    # Before any initializers run, but after the gems have been loaded
    config.before_initialize do
      # Replace the Mongoid Logger
      Mongoid.logger              = Sapience[Mongoid] if defined?(Mongoid)
      Moped.logger                = Sapience[Moped] if defined?(Moped)

      # Replace the Resque Logger
      Resque.logger               = Sapience[Resque] if defined?(Resque) && Resque.respond_to?(:logger)

{'fraction_non_alphanumeric': 0.09903846153846153, 'fraction_numerical': 0.0, 'mean_word_length': 3.2210953346855984, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2719330', 'n_tokens_mistral': 638, 'n_tokens_neox': 623, 'n_words': 146}