<commit_before>require 'uri'

module URLFilter
  # add http:// if no protocol at beginning of url
  def url(input)
    if 0 != input.index(/\w+?:\/\//)
      input = 'http://' + input
    end
    input
  end

  # host part of URL
  def host(input)
    input = URI(url(input)).host
  end<commit_msg>make sure URLs are not empty or space only strings<commit_after>require 'uri'

module URLFilter
  # add http:// if no protocol at beginning of url
  def url(input)
    input = input.strip
    if !input.strip.empty? and 0 != input.index(/\w+?:\/\//)
      input = 'http://' + input
    end
    input
  end

  # host part of URL
  def host(input)
    if !input.strip.empty?
      input = URI(url(input)).host
    end
  end
{'fraction_non_alphanumeric': 0.1309192200557103, 'fraction_numerical': 0.002785515320334262, 'mean_word_length': 2.4075829383886256, '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': '6908800', 'n_tokens_mistral': 245, 'n_tokens_neox': 239, 'n_words': 81}