<commit_before>require 'rdf/turtle'
require 'yummydata/data_format'

module Yummydata

  class VoID

    include Yummydata::DataFormat

    ##
    # return the license of VoID
    #
    # @return [String]
    attr_reader :license

    ##
    # return the publisher of VoID
    #
    # @return [String]
    attr_reader :publisher

    ##
    # return the last_modified of some VoID data
    #
    # @return [String]
    attr_reader :last_modified

    def initialize(http_response)
      @license = []
      @publisher = []
      @last_modified = ''

      if (!http_response.nil?)
        text = http_response.body
        data = parse(text, TTL)
        if (!data.nil?)
          data.each do |subject, predicate, object|
            @licanse.push object.to_s if predicate == RDF::URI('http://purl.org/dc/terms/license')
            @publisher.push object.to_s if predicate == RDF::URI('http://purl.org/dc/terms/publisher')
          end
        else
          data = parse(text, XML)
          if (!data.nil?)
            data.each do |subject, predicate, object|
              @licanse.push object.to_s if predicate == RDF::URI('http://purl.org/dc/terms/license')
              @publisher.push object.to_s if predicate == RDF::URI('http://purl.org/dc/terms/publisher')
            end
          end
        end
        @modified = if data.nil? ? 'N/A' : data['dcterms:modified']
        @license = @license.join('<br/>')
        @publisher = @publisher.join('<br/>')
      end
    end

  end
end<commit_msg>change VoID class for generalization.<commit_after>require 'rdf/turtle'
require 'yummydata/data_format'

module Yummydata

  class VoID

    include Yummydata::DataFormat

    ##
    # return the VoID as string
    #
    # @return [String]
    attr_reader :text

    ##
    # return the license of VoID
    #
    # @return [String]
    attr_reader :license

    ##
    # return the publisher of VoID
    #
    # @return [String]
    attr_reader :publisher

    ##
    # return the last_modified of some VoID data
    #
    # @return [String]
    attr_reader :last_modified

    def initialize(http_response)
      @text = http_response.body
      @license = nil
      @publisher = nil
      @modified = nil

      data = parse(@text, TTL)
      data = parse(@text, XML) if data.nil?
      return if data.nil?

      data.each do |subject, predicate, object|
        @licanse.push object.to_s if predicate == RDF::URI('http://purl.org/dc/terms/license')
        @publisher.push object.to_s if predicate == RDF::URI('http://purl.org/dc/terms/publisher')
        @modified.push object.to_s if predicate == RDF::URI('http://purl.org/dc/terms/modified')
      end
    end

  end
end
{'fraction_non_alphanumeric': 0.12169705991812431, 'fraction_numerical': 0.0, 'mean_word_length': 2.262135922330097, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1032628', 'n_tokens_mistral': 883, 'n_tokens_neox': 844, 'n_words': 202}