<commit_before><?php
	
	function read_config()
	{
		$config=array();
		
		$contents=file_get_contents('config.txt');
		$lines=explode("\n", $contents);
		
		foreach ($lines as $line) {
			$content=explode('#', $line);
			$fields=explode('=', trim($content[0]));
			if (count($fields)==2) {
				if (is_numeric(strpos($fields[0], '.'))) {
					$parts=explode('.', $fields[0]);
					$config[$parts[0]][$parts[1]]=$fields[1];
				} else {
					$config[$fields[0]]=$fields[1];
				}
			}
		}
		
		return $config;
	}
	
	function json_rpc_send($host, $port, $user, $password, $method, $params=array())
	{
		$url='http://'.$host.':'.$port.'/';
				
		$payload=json_encode(array(
			'id' => time(),
			'method' => $method,
			'params' => $params,
		));
		
	//	echo '<PRE>'; print_r($payload); echo '</PRE>';
		
		$ch=curl_init($url);<commit_msg>Show error message if curl not installed<commit_after><?php
	
	function read_config()
	{
		$config=array();
		
		$contents=file_get_contents('config.txt');
		$lines=explode("\n", $contents);
		
		foreach ($lines as $line) {
			$content=explode('#', $line);
			$fields=explode('=', trim($content[0]));
			if (count($fields)==2) {
				if (is_numeric(strpos($fields[0], '.'))) {
					$parts=explode('.', $fields[0]);
					$config[$parts[0]][$parts[1]]=$fields[1];
				} else {
					$config[$fields[0]]=$fields[1];
				}
			}
		}
		
		return $config;
	}
	
	function json_rpc_send($host, $port, $user, $password, $method, $params=array())
	{
		if (!function_exists('curl_init')) {
			echo '<div class="bg-danger" style="padding:1em;">This web demo requires the curl extension for PHP. Please contact your web hosting provider or system administrator for assistance.</div>';
			exit;
		}
		
		$url='http://'.$host.':'.$port.'/';
				
		$payload=json_encode(array(
			'id' => time(),
			'method' => $method,
			'params' => $params,
		));
		
	//	echo '<PRE>'; print_r($payload); echo '</PRE>';
		
		$ch=curl_init($url);
{'fraction_non_alphanumeric': 0.2357473035439137, 'fraction_numerical': 0.009758602978941962, 'mean_word_length': 3.845771144278607, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '6384656', 'n_tokens_mistral': 842, 'n_tokens_neox': 698, 'n_words': 125}