<commit_before>module Rippersnapper
  class DomainParser

    def initialize url
      @url = url
    end

    def suffix
      @suffix ||= begin
        found = nil
        parts_count.times do |iteration|
          test = url_parts.last(iteration + 1).join(".")
          found = test if suffix_exists?(test)
        end
        found.to_s
      end
    end

    def domain
      @domain ||= begin
        remaining = url_parts - suffix_parts
        remaining.last.to_s
      end
    end

    def subdomain<commit_msg>Document domain parser class<commit_after>module Rippersnapper
  class DomainParser

    # @params url [String] Url to be parsed
    # @return [self]
    def initialize url
      @url = url
    end

    # @return [String] The suffix for the url taken in initialize
    # @example
    #   DomainParser.new("www.google.com").suffix #=> "com"
    def suffix
      @suffix ||= begin
        found = nil
        parts_count.times do |iteration|
          test = url_parts.last(iteration + 1).join(".")
          found = test if suffix_exists?(test)
        end
        found.to_s
      end
    end

    # @return [String] The domain for the url taken in initialize
    # @example
    #   DomainParser.new("www.google.com").domain #=> "google"
    def domain
      @domain ||= begin
        remaining = url_parts - suffix_parts
        remaining.last.to_s
      end
    end

    # @return [String] The subdomain for the url taken in initialize
    # @example
    #   DomainParser.new("www.google.com").subdomain #=> "www"
    def subdomain
{'fraction_non_alphanumeric': 0.09137709137709138, 'fraction_numerical': 0.001287001287001287, 'mean_word_length': 2.061023622047244, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '2536286', 'n_tokens_mistral': 472, 'n_tokens_neox': 455, 'n_words': 134}