<commit_before>module ByNavigation
  class Configuration
    @@registered_by_id = {}
    @@registered_by_url = {}

    def initialize(id, &block)
      register(ByNavigation::Item.new(id, "", {}, &block))
    end

    def register(item)
      @@registered_by_id[item.id] = item
      @@registered_by_url[item.url] = item
      item.children.each { |c| self.register(c) }
    end

    def self.registered_by_id
      @@registered_by_id
    end

    def self.get_item(id_or_url = :main)
      id_or_url.is_a?(Symbol) ? get_item_by_id(id_or_url) : get_item_by_url(id_or_url)
    end

    def self.get_item_by_id(id)
      @@registered_by_id[id]
    end

    def self.get_item_by_url(url)
      @@registered_by_url[url]
    end
  end
end<commit_msg>get_item: Add slash at the start of url if not present<commit_after>module ByNavigation
  class Configuration
    @@registered_by_id = {}
    @@registered_by_url = {}

    def initialize(id, &block)
      register(ByNavigation::Item.new(id, "", {}, &block))
    end

    def register(item)
      @@registered_by_id[item.id] = item
      @@registered_by_url[item.url] = item
      item.children.each { |c| self.register(c) }
    end

    def self.registered_by_id
      @@registered_by_id
    end

    def self.get_item(id_or_url = :main)
      id_or_url = "/#{id_or_url}" if id_or_url.is_a?(String) && !id_or_url.start_with?('/')
      id_or_url.is_a?(Symbol) ? get_item_by_id(id_or_url) : get_item_by_url(id_or_url)
    end

    def self.get_item_by_id(id)
      @@registered_by_id[id]
    end

    def self.get_item_by_url(url)
      @@registered_by_url[url]
    end
  end
end
{'fraction_non_alphanumeric': 0.12076401725200246, 'fraction_numerical': 0.0, 'mean_word_length': 3.185567010309278, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3203680', 'n_tokens_mistral': 646, 'n_tokens_neox': 606, 'n_words': 100}