<commit_before>namespace :projects do
  task normalize_licenses: :environment do
    Project.where("licenses <> ''").where("normalized_licenses = '{}'").find_each do |project|
      project.normalize_licenses
      project.save
    end
  end

  task find_repos_in_homepage: :environment do
    Project.with_homepage.without_repository_url.find_each do |project|
      if homepage_gh = GithubRepository.extract_full_name(project.homepage)
        project.update_attribute(:repository_url, "https://github.com/#{homepage_gh}")
        project.update_github_repo<commit_msg>Task to update the elastic search index structure<commit_after>namespace :projects do
  task normalize_licenses: :environment do
    Project.where("licenses <> ''").where("normalized_licenses = '{}'").find_each do |project|
      project.normalize_licenses
      project.save
    end
  end

  task recreate_index: :environment do
    Project.__elasticsearch__.client.indices.delete index: 'projects'
    Project.__elasticsearch__.create_index! force: true
  end

  task find_repos_in_homepage: :environment do
    Project.with_homepage.without_repository_url.find_each do |project|
      if homepage_gh = GithubRepository.extract_full_name(project.homepage)
        project.update_attribute(:repository_url, "https://github.com/#{homepage_gh}")
        project.update_github_repo
{'fraction_non_alphanumeric': 0.09555555555555556, 'fraction_numerical': 0.0, 'mean_word_length': 4.676470588235294, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '2451178', 'n_tokens_mistral': 387, 'n_tokens_neox': 377, 'n_words': 75}