<commit_before><?php

$just_saved_factoid = false;
if($command == 'PRIVMSG' && stristr($message, ' is ')) {
	$factoid_array = explode(' is ', $message, 2);
	$factoid_name = $factoid_array[0];
	$factoid_value = str_replace(array("\n", "\r"), '', $factoid_array[1]);
	try {
		$datastore->put('factoid', $factoid_name, $factoid_value, null, true);
		reply('OK, ' . $source_nick . '.');
	} catch(DataStore_AlreadyExists_Exception $e) {
		$existing_factoid = $datastore->get('factoid', $factoid_name);
		reply('... but ' . $factoid_name . ' is ' . $existing_factoid . ' ...');
	}
	$just_saved_factoid = true;
}

$factoids = $datastore->getAll('factoid');
if(array_key_exists($message, $factoids) && !$just_saved_factoid) {
	$factoid_value = $datastore->get('factoid', $message);
	if(stristr($factoid_value, '<reply>')) {
		$factoid_value = substr($factoid_value, 7);
		reply($factoid_value);
	} else if(stristr($factoid_value, '<action>')) {
		$factoid_value = substr($factoid_value, 8);
		reply(chr(1) . 'ACTION ' . $factoid_value . chr(1));
	} else {
		reply($message . ' is ' . $factoid_value);
	}
}

if(command('forget', true)) {
	$factoid_name = $msg_args[1];
	try {
		$datastore->delete('factoid', $factoid_name, true);<commit_msg>Added an <alias> command for factoids, and a more DRY approach to parsing factoids<commit_after><?php

$just_saved_factoid = false;
if($command == 'PRIVMSG' && stristr($message, ' is ')) {
	$factoid_array = explode(' is ', $message, 2);
	$factoid_name = $factoid_array[0];
	$factoid_value = str_replace(array("\n", "\r"), '', $factoid_array[1]);
	try {
		$datastore->put('factoid', $factoid_name, $factoid_value, null, true);
		reply('OK, ' . $source_nick . '.');
	} catch(DataStore_AlreadyExists_Exception $e) {
		$existing_factoid = $datastore->get('factoid', $factoid_name);
		reply('... but ' . $factoid_name . ' is ' . $existing_factoid . ' ...');
	}
	$just_saved_factoid = true;
}

$factoids = $datastore->getAll('factoid');
if(array_key_exists($message, $factoids) && !$just_saved_factoid) {
	$factoid_value = $datastore->get('factoid', $message);
	$factoid_value = parseFactoid($factoid_value);
	reply($factoid_value);
}

if(command('forget', true)) {
	$factoid_name = $msg_args[1];
	try {
		$datastore->delete('factoid', $factoid_name, true);
{'fraction_non_alphanumeric': 0.20280332895313186, 'fraction_numerical': 0.005256241787122208, 'mean_word_length': 5.620289855072464, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 16, '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': '5768663', 'n_tokens_mistral': 894, 'n_tokens_neox': 881, 'n_words': 143}