<commit_before>namespace :peoplefinder do

  def inadequate_profiles
    @inadequate_profiles = Person.inadequate_profiles
  end

  def inadequate_profiles_with_email
    inadequate_profiles.select { |person| person.email.present? }
  end

  # list the email addresses of people with inadequate profiles
  task inadequate_profiles: :environment do

    inadequate_profiles.each do |person|
      puts "#{ person.surname }, #{ person.given_name }: #{ person.email }"
    end
    puts "\n** There are #{ inadequate_profiles.count } inadequate profiles."
    puts "** #{ inadequate_profiles_with_email.count }
      inadequate profiles have email addresses."
    puts "\n"
  end

  # email people with inadequate profiles
  task inadequate_profile_reminders: :environment do
    recipients = inadequate_profiles_with_email

    puts "\nYou are about to email #{ recipients.count } people"
    puts 'Are you sure you want to do this? [Y/N]'

    if STDIN.gets.chomp == 'Y'
      recipients.each do |recipient|

        if EmailAddress.new(recipient.email).valid_address?<commit_msg>Rake task descriptions are better than comments<commit_after>namespace :peoplefinder do

  def inadequate_profiles
    @inadequate_profiles = Person.inadequate_profiles
  end

  def inadequate_profiles_with_email
    inadequate_profiles.select { |person| person.email.present? }
  end

  desc 'list the email addresses of people with inadequate profiles'
  task inadequate_profiles: :environment do

    inadequate_profiles.each do |person|
      puts "#{ person.surname }, #{ person.given_name }: #{ person.email }"
    end
    puts "\n** There are #{ inadequate_profiles.count } inadequate profiles."
    puts "** #{ inadequate_profiles_with_email.count }
      inadequate profiles have email addresses."
    puts "\n"
  end

  desc 'email people with inadequate profiles'
  task inadequate_profile_reminders: :environment do
    recipients = inadequate_profiles_with_email

    puts "\nYou are about to email #{ recipients.count } people"
    puts 'Are you sure you want to do this? [Y/N]'

    if STDIN.gets.chomp == 'Y'
      recipients.each do |recipient|

        if EmailAddress.new(recipient.email).valid_address?
{'fraction_non_alphanumeric': 0.08363636363636363, 'fraction_numerical': 0.0, 'mean_word_length': 3.774403470715835, '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': '6689864', 'n_tokens_mistral': 696, 'n_tokens_neox': 639, 'n_words': 185}