<commit_before>#lib/task/db_populate
require 'factory_girl'

namespace :db do
    namespace :pop do

        # method which generates entries
        def pop_places (count, ptype = 'city')

            print "Creating #{count} #{ptype} in ".green; print "#{Rails.env}".green.bold; print " database ".green
            
            # include all of the factories in spec
            Dir['./spec/factories/*.rb'].each { |f| require f.to_s }
            
            dval = (count / 10) || 1
            for i in 1..count
                place = FactoryGirl.create(:random_place_generator, ptype.intern)
                if i % dval == 0
                    print('.'.green)
                end
            end
            puts " done!".green.bold
        end

        # call should be db:pop:places (is app:db:pop:places -- NEED TO FIX THAT?)
        desc 'Seed database with development place data'
        task :places, [:type, :count] => :environment do |t, args|

            count = (args[:count] || 10).to_i

            puts
            puts "Seeding database with development place data".gray
            print "Using ".gray; print "#{Rails.env}".bold.gray; print " database.".gray
            puts
            
            fail "Cannot instantiate #{count} places! Terminating...".red.bold if count < 1
            
            pop_places(count,args[:type] || 'city')

        end

    end # namespace :places
end<commit_msg>fix pluralization<commit_after>#lib/task/db_populate
require 'factory_girl'

namespace :db do
    namespace :pop do

        # method which generates entries
        def pop_places (count, ptype = 'city')

            print "Creating #{count} "; print "#{count > 1 ? ptype.pluralize : ptype} in ".green; print "#{Rails.env}".green.bold; print " database ".green
            
            # include all of the factories in spec
            Dir['./spec/factories/*.rb'].each { |f| require f.to_s }
            
            dval = [ (count / 10), 1 ].max
            for i in 1..count
                place = FactoryGirl.create(:random_place_generator, ptype.intern)
                if i % dval == 0
                    print('.'.green)
                end
            end
            puts " done!".green.bold
        end

        # call should be db:pop:places (is app:db:pop:places -- NEED TO FIX THAT?)
        desc 'Seed database with development place data'
        task :places, [:type, :count] => :environment do |t, args|

            count = (args[:count] || 10).to_i

            puts
            puts "Seeding database with development place data".gray
            print "Using ".gray; print "#{Rails.env}".bold.gray; print " database.".gray
            puts
            
            fail "Cannot instantiate #{count} places! Terminating...".red.bold if count < 1
            
            pop_places(count,args[:type] || 'city')

        end

    end # namespace :places
end
{'fraction_non_alphanumeric': 0.11572802197802198, 'fraction_numerical': 0.005837912087912088, 'mean_word_length': 1.6651418115279049, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '2943267', 'n_tokens_mistral': 847, 'n_tokens_neox': 793, 'n_words': 249}