<commit_before>class Knj::Google_sitemap
	attr_reader :doc
	
	def initialize
		#used for Time.iso8601.
		require "time"
		
		@doc = REXML::Document.new
		@doc << REXML::XMLDecl.new("1.0", "UTF-8")
		
		@urlset = @doc.add_element("urlset")
		@urlset.add_attributes("xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9")
	end
	
	def add_url(url_value, lastmod_value, cf_value = nil, priority_value = nil)
		el = REXML::Element.new("url")
		
		loc = el.add_element("loc")
		loc.text = url_value
		
		if !lastmod_value or lastmod_value.to_i == 0
			raise sprintf("Invalid date: %1$s, url: %2$s", lastmod_value.to_s, url_value)
		end
		
		lm = el.add_element("lastmod")
		lm.text = lastmod_value.iso8601
		
		if cf_value
			cf = el.add_element("changefreq")
			cf.text = cf_value
		end
		
		if priority_value
			priority = el.add_element("priority")
			priority.text = priority_value
		end
		
		@doc.root << el
	end
	
	def to_xml
		return @doc.to_s
	end
	
	def to_s
		return @doc.to_s
	end
	
	def write
		writer = REXML::Formatters::Pretty.new(5)
		writer.write(@doc, $stdout)
	end
end<commit_msg>Possible to give minimum date to Google_sitemap.<commit_after>class Knj::Google_sitemap
	attr_reader :doc
	
	def initialize(args = {})
    @args = args
    
		#used for Time.iso8601.
		require "time"
		
		@doc = REXML::Document.new
		@doc << REXML::XMLDecl.new("1.0", "UTF-8")
		
		@urlset = @doc.add_element("urlset")
		@urlset.add_attributes("xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9")
	end
	
	def add_url(url_value, lastmod_value, cf_value = nil, priority_value = nil)
		el = REXML::Element.new("url")
		
		loc = el.add_element("loc")
		loc.text = url_value
		
		if !lastmod_value or lastmod_value.to_i == 0
			raise sprintf("Invalid date: %1$s, url: %2$s", lastmod_value.to_s, url_value)
		end
		
		lm = el.add_element("lastmod")
		if @args.has_key?(:date_min) and @args[:date_min] > lastmod_value
      lastmod_value = @args[:date_min]
    end
		
		lm.text = lastmod_value.iso8601
		
		if cf_value
			cf = el.add_element("changefreq")
			cf.text = cf_value
		end
		
		if priority_value
			priority = el.add_element("priority")
			priority.text = priority_value
		end
		
		@doc.root << el
	end
	
	def to_xml
		return @doc.to_s
	end
	
	def to_s
		return @doc.to_s
	end
	
	def write
		writer = REXML::Formatters::Pretty.new(5)
		writer.write(@doc, $stdout)
	end
end
{'fraction_non_alphanumeric': 0.132996632996633, 'fraction_numerical': 0.01430976430976431, 'mean_word_length': 3.4849056603773585, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, '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': '4791169', 'n_tokens_mistral': 1068, 'n_tokens_neox': 919, 'n_words': 189}