<commit_before><?php

function Streams_after_Streams_message_Streams_unrelatedTo($params)
{
	$message = $params['message'];
	$type = $message->getInstruction('type', null);
	$stream = $params['stream'];

	// check if new relations available and send appropriate messages
	Streams::checkAvailableRelations(null, $stream->publisherId, $stream->name, $type);

	if (!Q_Config::get('Streams', 'categorize', $stream->type, $type, false)) {
		return;
	}

	$c = new Streams_Category();
	$c->publisherId = $stream->publisherId;
	$c->streamName = $stream->name;
	
	$fromPublisherId = $message->getInstruction('fromPublisherId', null);
	$fromStreamName = $message->getInstruction('fromStreamName', null);
	if (!isset($fromPublisherId) or !isset($fromStreamName)) {
		return;
	}
	
	// Begin database transaction
	$relatedTo = $c->retrieve(null, array('begin' => true))
		? json_decode($c->relatedTo, true)
		: array();
	if (isset($relatedTo[$type])) {
		foreach ($relatedTo[$type] as $weight => $info) {
			if ($info[0] === $fromPublisherId
			and $info[1] === $fromStreamName) {
				unset($relatedTo[$type][$weight]);
				break;
			}
		}
		$o = $message->getInstruction('options', null);
		$w = $message->getInstruction('weight', null);
		if (!empty($o['adjustWeights'])) {<commit_msg>Changed unrelatedTo hook also, to avoid starting session<commit_after><?php

function Streams_after_Streams_message_Streams_unrelatedTo($params)
{
	$message = $params['message'];
	$type = $message->getInstruction('type', null);
	$stream = $params['stream'];

	// check if new relations available and send appropriate messages
	Streams::checkAvailableRelations($stream->publisherId, $stream->publisherId, $stream->name, $type);

	if (!Q_Config::get('Streams', 'categorize', $stream->type, $type, false)) {
		return;
	}

	$c = new Streams_Category();
	$c->publisherId = $stream->publisherId;
	$c->streamName = $stream->name;
	
	$fromPublisherId = $message->getInstruction('fromPublisherId', null);
	$fromStreamName = $message->getInstruction('fromStreamName', null);
	if (!isset($fromPublisherId) or !isset($fromStreamName)) {
		return;
	}
	
	// Begin database transaction
	$relatedTo = $c->retrieve(null, array('begin' => true))
		? json_decode($c->relatedTo, true)
		: array();
	if (isset($relatedTo[$type])) {
		foreach ($relatedTo[$type] as $weight => $info) {
			if ($info[0] === $fromPublisherId
			and $info[1] === $fromStreamName) {
				unset($relatedTo[$type][$weight]);
				break;
			}
		}
		$o = $message->getInstruction('options', null);
		$w = $message->getInstruction('weight', null);
		if (!empty($o['adjustWeights'])) {
{'fraction_non_alphanumeric': 0.18642117376294592, 'fraction_numerical': 0.0015343306482546988, 'mean_word_length': 5.774025974025974, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 36, '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': '6444333', 'n_tokens_mistral': 919, 'n_tokens_neox': 857, 'n_words': 169}