<commit_before>class Speech
  attr_accessor :speaker, :time, :url, :id, :content
  
  def initialize(speaker, time, url, major_count, minor_count, date, house, logger, sub_page_permanent_url)
    @speaker, @time, @url, @major_count, @minor_count, @date, @house, @logger, @sub_page_permanent_url =
      speaker, time, url, major_count, minor_count, date, house, logger, sub_page_permanent_url
    @content = Hpricot::Elements.new
  end
  
  def output(x)
    time = @time.nil? ? "unknown" : @time
    if @content.inner_text.strip == ""
      @logger.error "Empty speech by #{@speaker.person.name.full_name} on #{@sub_page_permanent_url}"
    end
    if @speaker
      x.speech(:speakername => @speaker.name.full_name, :time => time, :url => @url, :id => id,
        :speakerid => @speaker.id) { x << @content.to_s }
    else
      x.speech(:speakername => "unknown", :time => time, :url => @url, :id => id) { x << @content.to_s }
    end
  end

  def append_to_content(content)
    if content.kind_of?(Array)
      @content = @content + content
    else
      @content << content
    end
  end
  
  def id<commit_msg>Added quoting of URL back in because it turns out if this is not there things appear to work but the HTML is not standards compliant<commit_after>class Speech
  attr_accessor :speaker, :time, :url, :id, :content
  
  def initialize(speaker, time, url, major_count, minor_count, date, house, logger, sub_page_permanent_url)
    @speaker, @time, @url, @major_count, @minor_count, @date, @house, @logger, @sub_page_permanent_url =
      speaker, time, url, major_count, minor_count, date, house, logger, sub_page_permanent_url
    @content = Hpricot::Elements.new
  end
  
  def output(x)
    time = @time.nil? ? "unknown" : @time
    if @content.inner_text.strip == ""
      @logger.error "Empty speech by #{@speaker.person.name.full_name} on #{@sub_page_permanent_url}"
    end
    if @speaker
      x.speech(:speakername => @speaker.name.full_name, :time => time, :url => url_quote(@url), :id => id,
        :speakerid => @speaker.id) { x << @content.to_s }
    else
      x.speech(:speakername => "unknown", :time => time, :url => url_quote(@url), :id => id) { x << @content.to_s }
    end
  end

  # Quoting of url's is required to be nice and standards compliant
  def url_quote(url)
    url.gsub('&', '&amp;')
  end
  
  def append_to_content(content)
    if content.kind_of?(Array)
      @content = @content + content
    else
      @content << content
    end
  end
  
  def id
{'fraction_non_alphanumeric': 0.1364, 'fraction_numerical': 0.0, 'mean_word_length': 3.490125673249551, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, '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': '1247286', 'n_tokens_mistral': 890, 'n_tokens_neox': 877, 'n_words': 232}