<commit_before>require 'rubygems'
require 'sinatra'
require 'environment'

configure do
  set :views, "#{File.dirname(__FILE__)}/views"
end

error do
  e = request.env['sinatra.error']
  puts e.to_s
  puts e.backtrace.join('\n')
  'Application error'
end

helpers do
  def highlight(text)
    SiteConfig.search_keywords.each do |keyword|
      text = text.gsub(/(#{keyword})/i, '<span class="highlight">\1</span>')
    end
    activate_links(text)
  end

  def activate_links(text)
    text.gsub(/((https?:\/\/|www\.)([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?)/, '<a href="\1">\1</a>'). \
      gsub(/@(\w+)/, '<a href="http://twitter.com/\1">@\1</a>')<commit_msg>backtrace dump should use Kernel.puts<commit_after>require 'rubygems'
require 'sinatra'
require 'environment'

configure do
  set :views, "#{File.dirname(__FILE__)}/views"
end

error do
  e = request.env['sinatra.error']
  Kernel.puts e.backtrace.join("\n")
  'Application error'
end

helpers do
  def highlight(text)
    SiteConfig.search_keywords.each do |keyword|
      text = text.gsub(/(#{keyword})/i, '<span class="highlight">\1</span>')
    end
    activate_links(text)
  end

  def activate_links(text)
    text.gsub(/((https?:\/\/|www\.)([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?)/, '<a href="\1">\1</a>'). \
      gsub(/@(\w+)/, '<a href="http://twitter.com/\1">@\1</a>')
{'fraction_non_alphanumeric': 0.25277983691623424, 'fraction_numerical': 0.007412898443291327, 'mean_word_length': 3.530201342281879, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2303073', 'n_tokens_mistral': 536, 'n_tokens_neox': 529, 'n_words': 91}