<commit_before><?php
// vim: set ts=4 sts=4 sw=4 si noet:

if (!function_exists('object_to_array')):

function object_to_array($var) {
	$result = array();
	$references = array();

	// loop over elements/properties
	foreach ($var as $key => $value) {
		// recursively convert objects
		if (is_object($value) || is_array($value)) {
			// but prevent cycles
			if (!in_array($value, $references)) {
				$result[$key] = object_to_array($value);
				$references[] = $value;
			}
		} else {
			// simple values are untouched
			$result[$key] = $value;
		}
	}
	return $result;
}

endif;

function array_key_value($key, $array, $emptyValue = 0) {
	return array_key_exists($key, $array) ? $array[$key] : $emptyValue;
}

function _json_encode($array) {
	$buffer = json_encode($array);
	$buffer = str_replace('\r\n', '', $buffer);
	$buffer = str_replace('\n', '', $buffer);
	$buffer = str_replace('\r', '', $buffer);
	$buffer = str_replace('\t', '', $buffer);
	$buffer = str_replace('\"', '"', $buffer);
	$buffer = str_replace('"<script>', '', $buffer);
	$buffer = str_replace('<\/script>"', '', $buffer);
	return $buffer;
}

?><commit_msg>removing unused function object_to_array()<commit_after><?php
// vim: set ts=4 sts=4 sw=4 si noet:

function array_key_value($key, $array, $emptyValue = 0) {
	return array_key_exists($key, $array) ? $array[$key] : $emptyValue;
}

function _json_encode($array) {
	$buffer = json_encode($array);
	$buffer = str_replace('\r\n', '', $buffer);
	$buffer = str_replace('\n', '', $buffer);
	$buffer = str_replace('\r', '', $buffer);
	$buffer = str_replace('\t', '', $buffer);
	$buffer = str_replace('\"', '"', $buffer);
	$buffer = str_replace('"<script>', '', $buffer);
	$buffer = str_replace('<\/script>"', '', $buffer);
	return $buffer;
}

?>
{'fraction_non_alphanumeric': 0.22209631728045326, 'fraction_numerical': 0.004532577903682719, 'mean_word_length': 4.906354515050167, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, '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': '65275', 'n_tokens_mistral': 660, 'n_tokens_neox': 646, 'n_words': 135}