<commit_before>/**
* @param  {!string} str
* @return {!string}
*/
function html_entity_decode(str)
{
	var b = document.createElement('b');

	// We escape left brackets so that we don't inadvertently evaluate some nasty HTML such as
	// <img src=... onload=evil() />
	b.innerHTML = str.replace(/</g, '&lt;');

	return b.textContent;
}

/**
* @param  {!string} str
* @return {!string}
*/
function htmlspecialchars_compat(str)
{
	var t = {
		'<' : '&lt;',
		'>' : '&gt;',
		'&' : '&amp;',
		'"' : '&quot;'
	};
	return str.replace(
		/[<>&"]/g,
		/**
		* @param {!string} c
		*/
		function(c)
		{
			return t[c];
		}
	);
}

/**
* @param  {!string} str<commit_msg>utils.js: cache the element used in html_entity_decode()<commit_after>/**
* @param  {!string} str
* @return {!string}
*/
function html_entity_decode(str)
{
	var b = document.createElement('b');

	html_entity_decode = function (str)
	{
		// We escape left brackets so that we don't inadvertently evaluate some nasty HTML such as
		// <img src=... onload=evil() />
		b.innerHTML = str.replace(/</g, '&lt;');

		return b.textContent;
	}

	return html_entity_decode(str);
}

/**
* @param  {!string} str
* @return {!string}
*/
function htmlspecialchars_compat(str)
{
	var t = {
		'<' : '&lt;',
		'>' : '&gt;',
		'&' : '&amp;',
		'"' : '&quot;'
	};
	return str.replace(
		/[<>&"]/g,
		/**
		* @param {!string} c
		*/
		function(c)
		{
			return t[c];
		}
	);
}

/**
* @param  {!string} str
{'fraction_non_alphanumeric': 0.22468793342579751, 'fraction_numerical': 0.0, 'mean_word_length': 3.231671554252199, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '1833245', 'n_tokens_mistral': 627, 'n_tokens_neox': 579, 'n_words': 128}