<commit_before><?php
namespace phpdotnet\phd;
/* $Id$ */

$ROOT = __DIR__;
function autoload($name)
{
    $file = str_replace(array('\\', '_'), '/', $name) . '.php';
    if (!fclose(fopen($file,'r', true))) {
        throw new \Exception('Cannot find file for ' . $name . ': ' . $file);
    }
    require_once $file;
}
spl_autoload_register(__NAMESPACE__ . '\\autoload');
require_once 'phpdotnet/phd/functions.php';

$optparser = new BuildOptionsParser();
$optparser->getopt();

define("NO_SQLITE", false);

/* If no docbook file was passed, die */
if (!is_dir(Config::xml_root()) || !is_file(Config::xml_file())) {
    trigger_error("No Docbook file given. Specify it on the command line with --docbook.", E_USER_ERROR);
}
if (!file_exists(Config::output_dir())) {
    v("Creating output directory..", E_USER_NOTICE);
    if (!mkdir(Config::output_dir())) {
        v("Can't create output directory", E_USER_ERROR);<commit_msg>- Fix fclose() error message on not-found-file - Don't use _once(), something is b0rked when trying to autoload the same file twice and we need the errormsg to find out about it<commit_after><?php
namespace phpdotnet\phd;
/* $Id$ */

$ROOT = __DIR__;
function autoload($name)
{
    $file = str_replace(array('\\', '_'), '/', $name) . '.php';
    if (!$fp = fopen($file,'r', true)) {
        throw new \Exception('Cannot find file for ' . $name . ': ' . $file);
    }   
    fclose($fp);
    require $file;
}
spl_autoload_register(__NAMESPACE__ . '\\autoload');
require_once 'phpdotnet/phd/functions.php';

$optparser = new BuildOptionsParser();
$optparser->getopt();

define("NO_SQLITE", false);

/* If no docbook file was passed, die */
if (!is_dir(Config::xml_root()) || !is_file(Config::xml_file())) {
    trigger_error("No Docbook file given. Specify it on the command line with --docbook.", E_USER_ERROR);
}
if (!file_exists(Config::output_dir())) {
    v("Creating output directory..", E_USER_NOTICE);
    if (!mkdir(Config::output_dir())) {
        v("Can't create output directory", E_USER_ERROR);
{'fraction_non_alphanumeric': 0.18002951303492376, 'fraction_numerical': 0.0004918839153959665, 'mean_word_length': 4.242268041237113, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '590357', 'n_tokens_mistral': 692, 'n_tokens_neox': 684, 'n_words': 173}