<commit_before>namespace :projects do
  desc 'Import from 24 Pull Requests'
  task import_from_24pr: :environment do
    26.times do |page|
      resp = RestClient.get "http://24pullrequests.com/projects.json?page=#{page+1}"
      projects = JSON.parse resp
      projects.each do |project|
        puts project["github_url"]
        Project.create_from_github_url project["github_url"]
      end
    end
  end<commit_msg>Task for updating project scores.<commit_after>namespace :projects do
  desc 'Import from 24 Pull Requests'
  task import_from_24pr: :environment do
    26.times do |page|
      resp = RestClient.get "http://24pullrequests.com/projects.json?page=#{page+1}"
      projects = JSON.parse resp
      projects.each do |project|
        puts project["github_url"]
        Project.create_from_github_url project["github_url"]
      end
    end
  end

  desc 'Re-calculate project scores'
  task recalculate_scores: :environment do
    Project.all.each do |project|
      calculator = ScoreCalculator.new(project)
      project.update_attribute(:score, calculator.score)
    end
  end
{'fraction_non_alphanumeric': 0.09289617486338798, 'fraction_numerical': 0.01639344262295082, 'mean_word_length': 3.3784860557768925, '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': '7022723', 'n_tokens_mistral': 336, 'n_tokens_neox': 322, 'n_words': 84}