<commit_before>'use strict'

var cp = require('child_process')
var fs = require('fs')
var http = require('http')
var https = require('https')
var path = require('path')
var url = require('url')
var rimraf = require('rimraf').sync
var AdmZip = require('adm-zip')

fs.existsSync = fs.existsSync || path.existsSync

var libPath = path.join(__dirname, 'lib', 'casperjs')
var tmpPath = path.join(__dirname, 'tmp')
var downloadUrl = 'https://github.com/n1k0/casperjs/archive/1.0.3.zip'



function isCasperInstalled(notInstalledCallback) {
    findInstalledCasper(function(path, version) {
        if (path) {
            console.log("Use already installed Casperjs.");
            console.log("  Version: " + stdout);
            console.log("  Path:    " + pathStdout);
            fs.symlinkSync(pathStdout.replace(/\s/, ''), './casperjs');
        } else {
            console.log("Casperjs not installed.  Installing.");
            notInstalledCallback();
        }
    });
}

function findInstalledCasper(foundCallback) {
    // Note that "which" doesn't work on windows...
    cp.exec("which casperjs", function(error, path, stderr) {
        if (path) {
            cp.exec("casperjs --version", function(error, version, stderr) {
                foundCallback(path.trim(), version.trim());
            });
        } else {
            foundCallback();
        }
    });
}

function tidyUp() {
    rimraf(tmpPath);
}

function unzipTheZippedFile() {
    var zip = new AdmZip(path.join(tmpPath, 'archive.zip'));
    zip.extractAllTo(libPath, true);<commit_msg>Fix worse errors after refactor<commit_after>'use strict'

var cp = require('child_process')
var fs = require('fs')
var http = require('http')
var https = require('https')
var path = require('path')
var url = require('url')
var rimraf = require('rimraf').sync
var AdmZip = require('adm-zip')

fs.existsSync = fs.existsSync || path.existsSync

var libPath = path.join(__dirname, 'lib', 'casperjs')
var tmpPath = path.join(__dirname, 'tmp')
var downloadUrl = 'https://github.com/n1k0/casperjs/archive/1.0.3.zip'



function isCasperInstalled(notInstalledCallback) {
    findInstalledCasper(function(path, version) {
        if (path) {
            console.log("Use already installed Casperjs.");
            console.log("  Version: " + version);
            console.log("  Path:    " + path);
            fs.symlinkSync(path, './casperjs');
        } else {
            console.log("Casperjs not installed.  Installing.");
            notInstalledCallback();
        }
    });
}

function findInstalledCasper(foundCallback) {
    // Note that "which" doesn't work on windows...
    cp.exec("which casperjs", function(error, path, stderr) {
        if (path) {
            cp.exec("casperjs --version", function(error, version, stderr) {
                foundCallback(path.trim(), version.trim());
            });
        } else {
            foundCallback();
        }
    });
}

function tidyUp() {
    rimraf(tmpPath);
}

function unzipTheZippedFile() {
    var zip = new AdmZip(path.join(tmpPath, 'archive.zip'));
    zip.extractAllTo(libPath, true);
{'fraction_non_alphanumeric': 0.15065852875040153, 'fraction_numerical': 0.0032123353678123997, 'mean_word_length': 2.834975369458128, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2514854', 'n_tokens_mistral': 966, 'n_tokens_neox': 949, 'n_words': 207}