<commit_before>class Page
  attr_reader :uri, :parent, :depth

  def initialize(uri, parent: nil, depth: 0)
    if uri.is_a? String
      uri = "http://#{uri}" unless uri.start_with? 'http'
      uri = URI.parse uri
      uri.fragment = false
    end

    @uri, @parent, @depth = uri, parent, depth
  end

  def error
    response.error
  end

  def code
    response.code || 'ERR'
  end

  def external?
    byebug unless uri.respond_to? :host
    uri.host != parent.uri.host
  end

  def inspect
    "#<Page url: #{url}, depth: #{depth}>"
  end

  def pages
    @pages ||= pages!
  end

  def url
    uri.to_s
  end

  def valid?
    !response.error
  end

private

  def anchors<commit_msg>remove byebug<commit_after>class Page
  attr_reader :uri, :parent, :depth

  def initialize(uri, parent: nil, depth: 0)
    if uri.is_a? String
      uri = "http://#{uri}" unless uri.start_with? 'http'
      uri = URI.parse uri
      uri.fragment = false
    end

    @uri, @parent, @depth = uri, parent, depth
  end

  def error
    response.error
  end

  def code
    response.code || 'ERR'
  end

  def external?
    uri.host != parent.uri.host
  end

  def inspect
    "#<Page url: #{url}, depth: #{depth}>"
  end

  def pages
    @pages ||= pages!
  end

  def url
    uri.to_s
  end

  def valid?
    !response.error
  end

private

  def anchors
{'fraction_non_alphanumeric': 0.1151560178306092, 'fraction_numerical': 0.0014858841010401188, 'mean_word_length': 2.3591022443890273, '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': '7508541', 'n_tokens_mistral': 490, 'n_tokens_neox': 471, 'n_words': 146}