<commit_before># == Source::Parser::Hcal
#
# Reads hCalendar events.
module Calagator

class Source::Parser::Hcal < Source::Parser
  self.label = :hCalendar

  EVENT_TO_HCALENDAR_FIELD_MAP = {
    :title => :summary,
    :description => :description,
    :start_time => :dtstart,
    :end_time => :dtend,
    :url => :url,
    :venue => :location,
  }

  def to_events
    hcals.map do |hcal|
      event = Event.new
      event.source = opts[:source]
      EVENT_TO_HCALENDAR_FIELD_MAP.each do |field, mofo_field|
        next unless hcal.respond_to?(mofo_field)
        next unless value = decoded_field(hcal, mofo_field)
        event.send "#{field}=", value<commit_msg>require vendored mofo dependency where its used.<commit_after># == Source::Parser::Hcal
#
# Reads hCalendar events.

vendored_mofo_dir = File.expand_path("../../../../../vendor/gems/mofo-0.2.8/lib", File.dirname(__FILE__))
$: << vendored_mofo_dir
require "mofo"

module Calagator

class Source::Parser::Hcal < Source::Parser
  self.label = :hCalendar

  EVENT_TO_HCALENDAR_FIELD_MAP = {
    :title => :summary,
    :description => :description,
    :start_time => :dtstart,
    :end_time => :dtend,
    :url => :url,
    :venue => :location,
  }

  def to_events
    hcals.map do |hcal|
      event = Event.new
      event.source = opts[:source]
      EVENT_TO_HCALENDAR_FIELD_MAP.each do |field, mofo_field|
        next unless hcal.respond_to?(mofo_field)
        next unless value = decoded_field(hcal, mofo_field)
        event.send "#{field}=", value
{'fraction_non_alphanumeric': 0.13743455497382198, 'fraction_numerical': 0.001963350785340314, 'mean_word_length': 3.3685714285714288, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '5819587', 'n_tokens_mistral': 537, 'n_tokens_neox': 542, 'n_words': 109}