<commit_before>#!/usr/bin/php
<?php

error_reporting(0);

date_default_timezone_set('UTC');

chdir('.');

set_include_path(realpath(__DIR__.'/../src') . PATH_SEPARATOR . get_include_path());

/**
 * Autoloader that implements the PSR-0 spec for interoperability between
 * PHP software.
 */
spl_autoload_register(
    function($className) {
        $fileParts = explode('\\', ltrim($className, '\\'));

        if (false !== strpos(end($fileParts), '_'))
            array_splice($fileParts, -1, 1, explode('_', current($fileParts)));

        $file = implode(DIRECTORY_SEPARATOR, $fileParts) . '.php';

        foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) {
            if (file_exists($path = $path . DIRECTORY_SEPARATOR . $file))
                return require $path;
        }
    }
);

$pi = new Respect\Foundation\ProjectInfo('.');
$command = str_replace('-', ' ', $argv[1]);
$command = ucwords($command);
$command = ucfirst($command);
$command = str_replace(' ', '', $command);
$generator = $pi->generate($command);
foreach (array_slice($argv, 2) as $method)
    $generator->$method();
echo $generator;<commit_msg>add option to enable debug info<commit_after>#!/usr/bin/php
<?php

error_reporting(0);

if (!function_exists('debug')) {
    function debug($message) {
        global $argv;
        static $debug;

        if (end($argv) == 'debug') {
            $debug = true;
            array_pop($argv);
            error_reporting(-1);
        }

        if ($debug) {
            echo $message, PHP_EOL;
        }
    }
}

debug('Generate start with args: '. implode(',', $argv));

date_default_timezone_set('UTC');

chdir('.');

set_include_path(realpath(__DIR__.'/../src') . PATH_SEPARATOR . get_include_path());

/**
 * Autoloader that implements the PSR-0 spec for interoperability between
 * PHP software.
 */
spl_autoload_register(
    function($className) {
        $fileParts = explode('\\', ltrim($className, '\\'));

        if (false !== strpos(end($fileParts), '_'))
            array_splice($fileParts, -1, 1, explode('_', current($fileParts)));

        $file = implode(DIRECTORY_SEPARATOR, $fileParts) . '.php';

        foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) {
            if (file_exists($path = $path . DIRECTORY_SEPARATOR . $file))
                return require $path;
        }
    }
);

$pi = new Respect\Foundation\ProjectInfo(getcwd());
$command = $argv[1];
debug("generate $command");
$generator = $pi->generate($command);
debug("done gen");
foreach (array_slice($argv, 2) as $method) {
debug("calling method $method");
    $generator->$method();
debug("done method $method");
}
debug("Result:");
echo $generator;

{'fraction_non_alphanumeric': 0.1786775631500743, 'fraction_numerical': 0.0048291233283803865, 'mean_word_length': 3.3435483870967744, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5252071', 'n_tokens_mistral': 881, 'n_tokens_neox': 857, 'n_words': 177}