<commit_before>// `npm install pg cookies formidable`
// Mu (git://github.com/chbrown/mu.git)
var sys = require('sys')
var fs = require('fs')
var path = require('path')
var http = require('http')
var util = require('util')
var pg = require('pg')
var mu = require('mu')
var querystring = require('querystring')
var formidable = require('formidable')
var Uuid = require('./lib/uuid')
var Cookies = require('cookies')
mu.root = path.join(__dirname, 'user_modules/dichotic/templates')

var repl = require('repl')

// ARGV[0] is "node" and [1] is the name of this script and [2] is the name of the first command line argument
var CONFIG = JSON.parse(fs.readFileSync(process.ARGV[2] || 'config.json'));

JSON.niceParse = function(str, default_obj) {
  try { return JSON.parse(str) }
  catch (e) { return default_obj }
}
String.prototype.capitalize = function() {
    return this.charAt(0).toUpperCase() + this.substr(1);
}
String.prototype.toTitleCase = function() { // <NAME> <http://individed.com>
  return this.replace(/([\w&`'‘’"“.@:\/\{\(\[<>_]+-? *)/g, function(match, p1, index, title) {
    if (index > 0 && title.charAt(index - 2) !== ":" &&
    	match.search(/^(a(nd?|s|t)?|b(ut|y)|en|for|i[fn]|o[fnr]|t(he|o)|vs?\.?|via)[ \-]/i) > -1)
        return match.toLowerCase();
    if (title.substring(index - 1, index + 1).search(/['"_{(\[]/) > -1)
        return match.charAt(0) + match.charAt(1).toUpperCase() + match.substr(2);
    if (match.substr(1).search(/[A-Z]+|&|[\w]+[._][\w]+/) > -1 || 
    	title.substring(index - 1, index + 1).search(/[\])}]/) > -1)
        return match;
    return match.charAt(0).toUpperCase() + match.substr(1);
  });
};
// this is not destructive! but it only returns a SHALLOW copy
// http://sedition.com/perl/javascript-fy.html<commit_msg>Less stringent on the config.json filename<commit_after>// `npm install pg cookies formidable`
// Mu (git://github.com/chbrown/mu.git)
var sys = require('sys')
var fs = require('fs')
var path = require('path')
var http = require('http')
var util = require('util')
var pg = require('pg')
var mu = require('mu')
var querystring = require('querystring')
var formidable = require('formidable')
var Uuid = require('./lib/uuid')
var Cookies = require('cookies')
mu.root = path.join(__dirname, 'user_modules/dichotic/templates')

var repl = require('repl')

// ARGV[0] is "node" and [1] is the name of this script and [2] is the name of the first command line argument
var config_file = (process.ARGV[2] && process.ARGV[2].substr(-5) == '.json') ? process.ARGV[2] : 'config.json'
var CONFIG = JSON.parse(fs.readFileSync(config_file));

JSON.niceParse = function(str, default_obj) {
  try { return JSON.parse(str) }
  catch (e) { return default_obj }
}
String.prototype.capitalize = function() {
    return this.charAt(0).toUpperCase() + this.substr(1);
}
String.prototype.toTitleCase = function() { // <NAME> <http://individed.com>
  return this.replace(/([\w&`'‘’"“.@:\/\{\(\[<>_]+-? *)/g, function(match, p1, index, title) {
    if (index > 0 && title.charAt(index - 2) !== ":" &&
    	match.search(/^(a(nd?|s|t)?|b(ut|y)|en|for|i[fn]|o[fnr]|t(he|o)|vs?\.?|via)[ \-]/i) > -1)
        return match.toLowerCase();
    if (title.substring(index - 1, index + 1).search(/['"_{(\[]/) > -1)
        return match.charAt(0) + match.charAt(1).toUpperCase() + match.substr(2);
    if (match.substr(1).search(/[A-Z]+|&|[\w]+[._][\w]+/) > -1 || 
    	title.substring(index - 1, index + 1).search(/[\])}]/) > -1)
        return match;
    return match.charAt(0).toUpperCase() + match.substr(1);
  });
};
// this is not destructive! but it only returns a SHALLOW copy
// http://sedition.com/perl/javascript-fy.html
{'fraction_non_alphanumeric': 0.21777050967566094, 'fraction_numerical': 0.013355137639683837, 'mean_word_length': 3.906417112299465, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 19, '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': '7499915', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1312, 'n_words': 298}