<commit_before>var utils = module.exports;

/**
 * Check and invoke callback function
 */
utils.invokeCallback = function(cb) {
	if(!!cb && typeof cb === 'function') {
		cb.apply(null, Array.prototype.slice.call(arguments, 1));
	}
};

/**
 * clone an object
 */
utils.clone = function(origin) {
	if(!origin) {
		return;
	}

	var obj = {};
	for(var f in origin) {
		if(origin.hasOwnProperty(f)) {
			obj[f] = origin[f];
		}
	}
	return obj;
};

utils.size = function(obj) {
	if(!obj) {
		return 0;
	}

	var size = 0;
	for(var f in obj) {
		if(obj.hasOwnProperty(f)) {
			size++;
		}
	}

	return size;
};

// print the file name and the line number
{
	Object.defineProperty(global, '__STACK__', {
		get: function(){
			var orig = Error.prepareStackTrace;
			Error.prepareStackTrace = function(_, stack){ return stack; };
			var err = new Error;
			Error.captureStackTrace(err, arguments.callee);
			var stack = err.stack;
			Error.prepareStackTrace = orig;
			return stack;
		}
	});

	Object.defineProperty(global, '__FILE__', {
			get: function() {
					return __STACK__[2].getFileName();
			}
	});

	Object.defineProperty(global, '__LINE__', {
		get: function(){
			return __STACK__[2].getLineNumber();
		}
	});
}

utils.myPrint = function() {
  var len = arguments.length;
	if(len <= 0) {
		return;
	}
	var aimStr = '\'' + __FILE__ + '\' @' + __LINE__ + ' :\n';
	for(var i = 0; i < len; ++i) {
		aimStr += arguments[i];
	}
	console.log('\n' + aimStr);
};
<commit_msg>add a new func to utils.js ~ myPrint<commit_after>var utils = module.exports;

/**
 * Check and invoke callback function
 */
utils.invokeCallback = function(cb) {
	if(!!cb && typeof cb === 'function') {
		cb.apply(null, Array.prototype.slice.call(arguments, 1));
	}
};

/**
 * clone an object
 */
utils.clone = function(origin) {
	if(!origin) {
		return;
	}

	var obj = {};
	for(var f in origin) {
		if(origin.hasOwnProperty(f)) {
			obj[f] = origin[f];
		}
	}
	return obj;
};

utils.size = function(obj) {
	if(!obj) {
		return 0;
	}

	var size = 0;
	for(var f in obj) {
		if(obj.hasOwnProperty(f)) {
			size++;
		}
	}

	return size;
};

// print the file name and the line number ~ begin
function getStack(){
	var orig = Error.prepareStackTrace;
	Error.prepareStackTrace = function(_, stack) {
		return stack;
	};
	var err = new Error();
	Error.captureStackTrace(err, arguments.callee);
	var stack = err.stack;
	Error.prepareStackTrace = orig;
	return stack;
}

function getFileName(stack) {
	return stack[1].getFileName();
}

function getLineNumber(stack){
	return stack[1].getLineNumber();
}

utils.myPrint = function() {
  var len = arguments.length;
	if(len <= 0) {
		return;
	}
	var stack = getStack();
	var aimStr = '\'' + getFileName(stack) + '\' @' + getLineNumber(stack) + ' :\n';
	for(var i = 0; i < len; ++i) {
		aimStr += arguments[i];
	}
	console.log('\n' + aimStr);
};
// print the file name and the line number ~ end

{'fraction_non_alphanumeric': 0.17344827586206896, 'fraction_numerical': 0.004827586206896552, 'mean_word_length': 3.4357798165137616, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '4712920', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1063, 'n_words': 251}