<commit_before>class Karasuba
  # A footer should look like this :
  # <div title="a-footer-id">
  #   <hr style="margin: 15px 0px;"/>
  #   <p display="color:#878888;">
  #     Lorem ipsum<br/>
  #     <NAME>
  #   </p>
  # </div>
  class FooterAppender
    attr_reader :append_point

    def initialize(append_point)
      @append_point = append_point
    end

    def append_footer(text_or_array = '', options = {})
      text_array        = Array(text_or_array)
      hr                = horizontal_rule(options)
      p                 = paragraph(text_nodes(text_array), options)
      div               = division(hr, p, options)
      append_point.next = div
      div
    end

    def document
      append_point.document
    end

    private

    def text_nodes(text_array)
      nodes = text_array.inject([]) do |ary, text|
        ary << Nokogiri::XML::Text.new(text, document)
        ary << Nokogiri::XML::Node.new('br', document)
      end
      nodes.tap(&:pop)
    end

    def paragraph(nodes, options)
      p          = Nokogiri::XML::Node.new('p', document)<commit_msg>Add a break element before the footer<commit_after>class Karasuba
  # A footer should look like this :
  # <div title="a-footer-id">
  #   <hr style="margin: 15px 0px;"/>
  #   <p display="color:#878888;">
  #     Lorem ipsum<br/>
  #     <NAME>
  #   </p>
  # </div>
  class FooterAppender
    attr_reader :append_point

    def initialize(append_point)
      @append_point = append_point
    end

    def append_footer(text_or_array = '', options = {})
      text_array = Array(text_or_array)
      hr         = horizontal_rule(options)
      p          = paragraph(text_nodes(text_array), options)
      div        = division(hr, p, options)
      br         = break_element(options)
      footer     = Nokogiri::XML::NodeSet.new(document, [br, div])
      append_point.next = footer
      footer
    end

    def document
      append_point.document
    end

    private

    def break_element(options)
      Nokogiri::XML::Node.new('br', document)
    end

    def text_nodes(text_array)
      nodes = text_array.inject([]) do |ary, text|
        ary << Nokogiri::XML::Text.new(text, document)
        ary << Nokogiri::XML::Node.new('br', document)
      end
      nodes.tap(&:pop)
    end

    def paragraph(nodes, options)
      p          = Nokogiri::XML::Node.new('p', document)
{'fraction_non_alphanumeric': 0.12242322254943205, 'fraction_numerical': 0.007572570466975179, 'mean_word_length': 2.325874125874126, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 17, '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': '6321334', 'n_tokens_mistral': 810, 'n_tokens_neox': 768, 'n_words': 166}