<commit_before>require 'json'
require 'digest/md5'
require 'open-uri'
require 'nokogiri'

class AnimeCalendar
  attr_reader :episodes, :shows
  def timer (name)
    if @verbose
      $stderr.print "%-8s  " % (name + ":")
      before = Time.now
      yield
      $stderr.print "%#.4fs\n" % (Time.now - before)
    else
      yield
    end
  end
  def initialize (date, verbose)
    @verbose = verbose
    @src = ""
    @doc = nil
    @shows = {}
    @episodes = []

    timer "Load" do
      @src = open("http://www.animecalendar.net/%4d/%d" % [date.year, date.month])
    end
    timer "Parse" do
      @doc = Nokogiri::HTML(@src)
    end
    timer "Process" do
      @doc.css('#calendarContent .day').each do |day|<commit_msg>Set default to AnimeCalendar::new for verbosity, for usage as a lib<commit_after>require 'json'
require 'digest/md5'
require 'open-uri'
require 'nokogiri'

class AnimeCalendar
  attr_reader :episodes, :shows
  def timer (name)
    if @verbose
      $stderr.print "%-8s  " % (name + ":")
      before = Time.now
      yield
      $stderr.print "%#.4fs\n" % (Time.now - before)
    else
      yield
    end
  end
  def initialize (date, verbose = false)
    @verbose = verbose
    @src = ""
    @doc = nil
    @shows = {}
    @episodes = []

    timer "Load" do
      @src = open("http://www.animecalendar.net/%4d/%d" % [date.year, date.month])
    end
    timer "Parse" do
      @doc = Nokogiri::HTML(@src)
    end
    timer "Process" do
      @doc.css('#calendarContent .day').each do |day|
{'fraction_non_alphanumeric': 0.14888010540184454, 'fraction_numerical': 0.005270092226613966, 'mean_word_length': 2.4601366742596813, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3265378', 'n_tokens_mistral': 547, 'n_tokens_neox': 535, 'n_words': 138}