<commit_before>var ini = require('ini');
var fs = require('graceful-fs');
var Log = require('log');

var arguments = require(__dirname + '/lib/arguments.js');

global.log = new Log('debug', fs.createWriteStream('crawler.log'));

global.parameters = ini.parse(
    fs.readFileSync(__dirname + '/config/parameters.ini', 'utf-8')
).parameters;

global.filmError = {};

arguments.getAction(function(action) {
    var crawler;

    switch (action) {
        case 'all':
            crawler = require(__dirname + '/lib/actions/all.js');
            break;
        case 'popular':
            crawler = require(__dirname + '/lib/actions/popular.js');
            break;
    }

    crawler.start();
});
<commit_msg>Improved way of loading actions<commit_after>var ini = require('ini');
var fs = require('graceful-fs');
var Log = require('log');

var arguments = require(__dirname + '/lib/arguments.js');

global.log = new Log('debug', fs.createWriteStream('crawler.log'));

global.parameters = ini.parse(
    fs.readFileSync(__dirname + '/config/parameters.ini', 'utf-8')
).parameters;

global.filmError = {};

arguments.getAction(function(action) {
    var crawler = require(__dirname + '/lib/actions/' + action + '.js');
    crawler.start();
});

{'fraction_non_alphanumeric': 0.17419354838709677, 'fraction_numerical': 0.0016129032258064516, 'mean_word_length': 3.613382899628253, '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': '4052802', 'n_tokens_mistral': 388, 'n_tokens_neox': 382, 'n_words': 78}