<commit_before>var dviz = (function() {


/*
 * Fast array min/max functions
 */
var array_min = function(array) {return Math.min.apply( Math, array );};
var array_max = function(array) {return Math.max.apply( Math, array );};

/*
 * Load javascript modules
 * 
 * Params:
 *    jsids: array of predefined script ids
 *    callback: called right after the job done.
 */
var load_reqs = function(jsids, callback) {
    var loaded = 0;
    for(var i = 0; i < jsids.length; i++) {
        load_req(jsids[i], function() {
            loaded++;
            if(loaded == jsids.length) callback();
        });
    }
};

/*
 * Load single javascript module
 * 
 * Params:
 *    jsid: predefined script id
 *    callback: called right after the job done.
 */
var load_req = function(jsid, callback) {
    var loader = load_req.loaders[jsid];
    if(loader.check()) {
        loader.callback(callback);
        return;
    }

    var script = document.createElement("script");
    script.src = loader.url;
    script.type = "text/javascript";
    script.onload = function () {
        loader.callback(callback);
    };
    document.getElementsByTagName("head")[0].appendChild(script);
};
load_req.loaders = {
    'd3': {
        'url': 'http://d3js.org/d3.v2.min.js',
        'check': function() {return !!window['d3'];},
        'callback': function(cb) {cb();}
    },
    'google-viz': {
        'url': 'https://www.google.com/jsapi',
        'check': function() {return !!window['google'];},
        'callback': function(cb) {
            google.load('visualization', '1.0', {
                'packages': ['corechart', 'table'],
                'callback': function() {cb();}
            });
        }
    },
    'opt_graph': {
        //'url': 'http://akngs.github.com/dviz/js/opt_graph.js',
        'url': '../js/opt_graph.js',
        'check': function() {return !!dviz.opt['graph'];},
        'callback': function(cb) {cb();}
    }
};

/*
 * Parse raw string and return array(for single line string)
 * or array of array(for multi-line string).
 * 
 * Params:
 *    raw: raw comma separated string
 *    hasColumnLabels: true if first row is header
 *    hasRowLabels: true if first column is header
 * <commit_msg>Load `opt_graph.js` from hosted github page<commit_after>var dviz = (function() {


/*
 * Fast array min/max functions
 */
var array_min = function(array) {return Math.min.apply( Math, array );};
var array_max = function(array) {return Math.max.apply( Math, array );};

/*
 * Load javascript modules
 * 
 * Params:
 *    jsids: array of predefined script ids
 *    callback: called right after the job done.
 */
var load_reqs = function(jsids, callback) {
    var loaded = 0;
    for(var i = 0; i < jsids.length; i++) {
        load_req(jsids[i], function() {
            loaded++;
            if(loaded == jsids.length) callback();
        });
    }
};

/*
 * Load single javascript module
 * 
 * Params:
 *    jsid: predefined script id
 *    callback: called right after the job done.
 */
var load_req = function(jsid, callback) {
    var loader = load_req.loaders[jsid];
    if(loader.check()) {
        loader.callback(callback);
        return;
    }

    var script = document.createElement("script");
    script.src = loader.url;
    script.type = "text/javascript";
    script.onload = function () {
        loader.callback(callback);
    };
    document.getElementsByTagName("head")[0].appendChild(script);
};
load_req.loaders = {
    'd3': {
        'url': 'http://d3js.org/d3.v2.min.js',
        'check': function() {return !!window['d3'];},
        'callback': function(cb) {cb();}
    },
    'google-viz': {
        'url': 'https://www.google.com/jsapi',
        'check': function() {return !!window['google'];},
        'callback': function(cb) {
            google.load('visualization', '1.0', {
                'packages': ['corechart', 'table'],
                'callback': function() {cb();}
            });
        }
    },
    'opt_graph': {
        'url': 'http://akngs.github.com/dviz/js/opt_graph.js',
        'check': function() {return !!dviz.opt['graph'];},
        'callback': function(cb) {cb();}
    }
};

/*
 * Parse raw string and return array(for single line string)
 * or array of array(for multi-line string).
 * 
 * Params:
 *    raw: raw comma separated string
 *    hasColumnLabels: true if first row is header
 *    hasRowLabels: true if first column is header
 * 
{'fraction_non_alphanumeric': 0.16625141562853907, 'fraction_numerical': 0.004530011325028313, 'mean_word_length': 2.521531100478469, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '6087270', 'n_tokens_mistral': 1415, 'n_tokens_neox': 1377, 'n_words': 341}