<commit_before>require './lib/tess_scrapers'

log = 'log/scrapers.log'
output = 'log/scrapers.out' # Need to logrotate this!

options = { output_file: output, debug: false, verbose: false, offline: false, cache: false } # Live!
# options = { output_file: output, debug: true, verbose: true, offline: false, cache: true } # Testing

if !ARGV[0]
  puts 'Provide name of scraper as argument. e.g. RssScraper'
else 
  scraper_class = ARGV[0]
  begin
    # Open log file
    log_file = File.open(log, 'w')
    log_file.puts "Running #{scraper_class}"
    scraper_class.constantize.new(options).run
    log_file.puts 'Done'
  ensure
    log_file.close
  end
end
<commit_msg>Added switch to `run.rb` to run in "testing" mode<commit_after>require './lib/tess_scrapers'

log = 'log/scrapers.log'
output = 'log/scrapers.out' # Need to logrotate this!

live = { output_file: output, debug: false, verbose: false, offline: false, cache: false } # Live!
testing = { output_file: output, debug: true, verbose: true, offline: false, cache: true } # Testing

options = (ARGV[1] == 'testing') ? testing : live

if !ARGV[0]
  puts 'Provide name of scraper as argument. e.g. RssScraper'
else 
  scraper_class = ARGV[0]
  begin
    # Open log file
    log_file = File.open(log, 'w')
    log_file.puts "Running #{scraper_class}"
    scraper_class.constantize.new(options).run
    log_file.puts 'Done'
  ensure
    log_file.close
  end
end

{'fraction_non_alphanumeric': 0.12623413258110014, 'fraction_numerical': 0.003526093088857546, 'mean_word_length': 3.9100346020761245, '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': '7157351', 'n_tokens_mistral': 524, 'n_tokens_neox': 515, 'n_words': 143}