<commit_before><?php

/*
Serverboy Interchange
index.json interpreter

Copyright 2010 Serverboy Software; <NAME>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

class interchange {

	function parse($directory) {
		// Load the JSON file
		$json = file_get_contents($directory);
		$data = json_decode($json);

		// Iterate each root (domain)
		foreach($data as $root) {
			$endpoint = self::domain($root);
			if(!empty($endpoint))
				break;
		}

		// Return an endpoint if it exists
		return (!empty($endpoint)) ? $endpoint : false;
	}

	function domain($node, $level = 0) {
		global $split_domain;

		$domain = $node->domain;

		if($parser != "*" && (empty($split_domain[$level]) || $split_domain[$level] != $domain))
			return false;

		$output = self::traverse($node->policies, $level + 1);
		if(is_string($output) && !empty($domain->log))
			define('`', (string)$domain->log);

		return $output;
	}

	function folder($node, $folder_level = 0) {
		global $path, $actual_file;

		$folder = $node->folder;

		if(!isset($path[$folder_level]) || $path[$folder_level] != (string)$folder)
			return false;

		// Shift the path up a directory.
		array_shift($actual_file);

		$result = self::traverse($node->policies, 0, $folder_level + 1);

		if($result === false)
			return true;
		else
			return $result;
	}

	private function traverse($node, $domain_level = 0, $folder_level = 0) {
		global $libraries;
<commit_msg>Fixed typo<commit_after><?php

/*
Serverboy Interchange
index.json interpreter

Copyright 2010 Serverboy Software; <NAME>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

class interchange {

	function parse($directory) {
		// Load the JSON file
		$json = file_get_contents($directory);
		$data = json_decode($json);

		// Iterate each root (domain)
		foreach($data as $root) {
			$endpoint = self::domain($root);
			if(!empty($endpoint))
				break;
		}

		// Return an endpoint if it exists
		return (!empty($endpoint)) ? $endpoint : false;
	}

	function domain($node, $level = 0) {
		global $split_domain;

		$domain = $node->domain;

		if($domain != "*" && (empty($split_domain[$level]) || $split_domain[$level] != $domain))
			return false;

		$output = self::traverse($node->policies, $level + 1);
		if(is_string($output) && !empty($domain->log))
			define('`', (string)$domain->log);

		return $output;
	}

	function folder($node, $folder_level = 0) {
		global $path, $actual_file;

		$folder = $node->folder;

		if(!isset($path[$folder_level]) || $path[$folder_level] != (string)$folder)
			return false;

		// Shift the path up a directory.
		array_shift($actual_file);

		$result = self::traverse($node->policies, 0, $folder_level + 1);

		if($result === false)
			return true;
		else
			return $result;
	}

	private function traverse($node, $domain_level = 0, $folder_level = 0) {
		global $libraries;

{'fraction_non_alphanumeric': 0.1367837338262477, 'fraction_numerical': 0.007921837866385001, 'mean_word_length': 4.246537396121884, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 0, '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': '56164', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1140, 'n_words': 375}