<commit_before>(function (till) {
	'use strict';

	/**
	 * @type {!Object}
	 */
	till.index = {};

	/**
	 * @constructor
	 */
	till.index.Controller = function () {
		/**
		 * @type {!till.common.Service}
		 * @private
		 */
		this.service_ = new till.common.Service();

		this.run_();
	};

	/**
	 * @private
	 */
	till.index.Controller.prototype.run_ = function () {
		var form = document.querySelector('form');
		form.addEventListener('submit', this.onSubmit_.bind(this));
	};

	/**
	 * @param {!Object.<string, string>} params
	 * @param {string} $0
	 * @param {string} $1
	 * @param {string} $2
	 * @param {string} $3
	 * @private
	 */
	till.index.Controller.prototype.bindParams_ = function(params, $0, $1, $2, $3) {
		params[$1] = $3;
	};

	/**
	 * @param {string} csv
	 * @return {!Array.<!Array.<string>>}
	 * @private
	 */
	till.index.Controller.prototype.csvToArray_ = function (csv) {
		var pattern = new RegExp(('(\\,|\\r?\\n|\\r|^)(?:\"([^\"]*(?:\"\"[^\"]*)*)\"|([^\"\\,\\r\\n]*))'), 'gi');
		var result = [[]];
		var matches = null;
		while (matches = pattern.exec(csv)) {
			var match = matches[1];
			if (match.length && match != ',') {
				result.push([]);
			}

			var value = matches[2] ? matches[2].replace(new RegExp('\"\"', 'g'), '\"') : matches[3];
			result[result.length - 1].push(value);
		}

		return result;
	};

	/**
	 * @param {number} status
	 * @param {string} statusText
	 * @param {string} responseText
	 * @private
	 */
	till.index.Controller.prototype.handleListAutos_ = function(status, statusText, responseText) {
		var rows = this.csvToArray_(responseText);
		this.renderPriceByYearChart_(rows);
		this.renderPriceByMileageChart_(rows);
	};

	/**
	 * @param {Event} e
	 * @private
	 */
	till.index.Controller.prototype.onSubmit_ = function (e) {
		e.preventDefault();<commit_msg>Clear the charts when a new one is being loaded<commit_after>(function (till) {
	'use strict';

	/**
	 * @type {!Object}
	 */
	till.index = {};

	/**
	 * @constructor
	 */
	till.index.Controller = function () {
		/**
		 * @type {!till.common.Service}
		 * @private
		 */
		this.service_ = new till.common.Service();

		this.run_();
	};

	/**
	 * @private
	 */
	till.index.Controller.prototype.run_ = function () {
		var form = document.querySelector('form');
		form.addEventListener('submit', this.onSubmit_.bind(this));
	};

	/**
	 * @param {!Object.<string, string>} params
	 * @param {string} $0
	 * @param {string} $1
	 * @param {string} $2
	 * @param {string} $3
	 * @private
	 */
	till.index.Controller.prototype.bindParams_ = function (params, $0, $1, $2, $3) {
		params[$1] = $3;
	};

	/**
	 * @private
	 */
	till.index.Controller.prototype.clearCharts_ = function () {
		var divs = document.getElementsByTagName('div');
		for (var i = 0, j = divs.length; i < j; ++i) {
			var div = divs[i];
			if (div.id && div.id.indexOf('chart-') == 0) {
				while (div.firstChild) {
					div.removeChild(div.firstChild);
				}
			}
		}
	};

	/**
	 * @param {string} csv
	 * @return {!Array.<!Array.<string>>}
	 * @private
	 */
	till.index.Controller.prototype.csvToArray_ = function (csv) {
		var pattern = new RegExp(('(\\,|\\r?\\n|\\r|^)(?:\"([^\"]*(?:\"\"[^\"]*)*)\"|([^\"\\,\\r\\n]*))'), 'gi');
		var result = [[]];
		var matches = null;
		while (matches = pattern.exec(csv)) {
			var match = matches[1];
			if (match.length && match != ',') {
				result.push([]);
			}

			var value = matches[2] ? matches[2].replace(new RegExp('\"\"', 'g'), '\"') : matches[3];
			result[result.length - 1].push(value);
		}

		return result;
	};

	/**
	 * @param {number} status
	 * @param {string} statusText
	 * @param {string} responseText
	 * @private
	 */
	till.index.Controller.prototype.handleListAutos_ = function(status, statusText, responseText) {
		var rows = this.csvToArray_(responseText);
		this.renderPriceByYearChart_(rows);
		this.renderPriceByMileageChart_(rows);
	};

	/**
	 * @param {Event} e
	 * @private
	 */
	till.index.Controller.prototype.onSubmit_ = function (e) {
		e.preventDefault();
		this.clearCharts_();

{'fraction_non_alphanumeric': 0.2205991582074771, 'fraction_numerical': 0.007922753156721961, 'mean_word_length': 3.2171189979123174, 'pattern_counts': {'":': 0, '<': 10, '<?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': '859306', 'n_tokens_mistral': 1608, 'n_tokens_neox': 1444, 'n_words': 269}