<commit_before>class Openidentity < ActiveRecord::Base
  belongs_to :user

  def self.lookup(url)
    find(:first, :conditions => {:url => cannonical(url)})
  end 

  def self.lookup_or_create(url)
    lookup(url) || create_id_and_user_with_url(url)
  end

  def self.create_id_and_user_with_url(url)
      new_user = User.create!
      Openidentity.create!(:user => new_user, :url => url)
  end

  def self.cannonical(url)
    # add a trailing slash if there is no slash after the hostname
    uri = URI.parse(url)
    if uri.path.blank?
      return uri.to_s+"/"
    end
    uri.to_s
  end
end<commit_msg>use cannonical URL form when creating new user record<commit_after>class Openidentity < ActiveRecord::Base
  belongs_to :user

  def self.lookup(url)
    find(:first, :conditions => {:url => cannonical(url)})
  end 

  def self.lookup_or_create(url)
    url = cannonical(url)
    lookup(url) || create_id_and_user_with_url(url)
  end

  def self.create_id_and_user_with_url(url)
      new_user = User.create!
      Openidentity.create!(:user => new_user, :url => cannonical(url))
  end

  def self.cannonical(url)
    # add a trailing slash if there is no slash after the hostname
    uri = URI.parse(url)
    if uri.path.blank?
      return uri.to_s+"/"
    end
    uri.to_s
  end
end
{'fraction_non_alphanumeric': 0.10758513931888544, 'fraction_numerical': 0.0, 'mean_word_length': 3.3979591836734695, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '1175595', 'n_tokens_mistral': 467, 'n_tokens_neox': 445, 'n_words': 109}