<commit_before>TextInfoLoader = (function() {

	var 
		locationBase = 'content/texts/',
		textIds = null,
		textInfoData = null,
		textData = {};


	function getText(textid, callback, errorCallback) {
		
		// if already loaded, then send it right bac
		var t = this,
			textinfo = textData[textid];
		
		if (typeof textinfo != 'undefined') {
			if (typeof callback != 'undefined') {
				callback(textinfo);
			}
			
			return textinfo;
		}
	
		// load it!
		$.ajax({
			url: locationBase + textid + '/info.json',
			dataType: 'json',
			success: function(data) {
				//console.log(textid, data);
				
				// store this one			
				textData[data.id] = data;
				
				callback(data);
			},
			error: function(error) {
				if (errorCallback) {
					errorCallback(error);	
				}			
			}
		});		
	}
	
	function loadTexts(callback) {
		if (textInfoData != null) {
			callback(textInfoData);			
		} else {
			loadTextsManifest(callback);			
		}	
	}

	function loadTextsManifest(callback) {
	
		var 
			textsFilename = 'texts.json',
			queryData = stringUtility.parseQuerystring();
		
		if (queryData['textlist']) {
			textsFilename = queryData['textlist'];
		}
		
		$.ajax({
			url: locationBase + textsFilename,
			dataType: 'json',
			cache: false,
			success: function(data) {
			
				textIds = data.textIds;
				textInfoData = data.textInfoData;
				
				if (callback) { 
					callback(textInfoData);
				}
			},
			error: function(jqXHR, textStatus, errorThrown) {
				//console.log('error loading texts.json'); //, jqXHR, textStatus, errorThrown);
				//console.log(textStatus);				
				
				var modal = new MovableWindow(600,250, 'Chrome Local Error');
				//modal.size(500, 200).center();
				
				modal.body.css({background: '#000', color: '#fff' }).html(
					'<div style="padding: 20px;">' + 
						'<p>Windows, Start, Run</p>' +
						'<code>"%UserProfile%\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe" --allow-file-access-from-files</code>' +				
						'<p>Mac, Terminal</p>' +
						'<code>/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --allow-file-access-from-files</code>'+ 
					'</div>'
				);
				modal.show();

				
			}
		});
	}
	loadTextsManifest();	
	
	var ext = {
		getText: getText,
		loadTexts: loadTexts,
		textData: textData	
	}
			
	return ext;
})();<commit_msg>temporary fix for broken JSON<commit_after>TextInfoLoader = (function() {

	var 
		locationBase = 'content/texts/',
		textIds = null,
		textInfoData = null,
		textData = {};


	function getText(textid, callback, errorCallback) {
		
		// if already loaded, then send it right bac
		var t = this,
			textinfo = textData[textid];
		
		if (typeof textinfo != 'undefined') {
			if (typeof callback != 'undefined') {
				callback(textinfo);
			}
			
			return textinfo;
		}
	
		// load it!
		var infoUrl = locationBase + textid + '/info.json';
		
		$.ajax({
			url: infoUrl,
			dataType: 'json',
			//dataType: 'text',
			success: function(data) {
				/*	
				// TEMP fix for Michael's data
				if (data.indexOf("audioDirectory") > -1) {
					var indexOfReturn = data.indexOf('\n', data.indexOf('audioDirectory') +1);
					
					if (indexOfReturn > -1) {
						data = data.substr(0,indexOfReturn) + ',' + data.substr(indexOfReturn);						
					}					
				}
				
				data = JSON.parse(data);
				*/
				
				
				// store this one			
				textData[data.id] = data;
				
				callback(data);
			},
			error: function(error) {
				
				console.log("ERROR TextInfoLoader.getText", infoUrl); 
			
				if (errorCallback) {
					errorCallback(error);	
				}			
			}
		});		
	}
	
	function loadTexts(callback) {
		if (textInfoData != null) {
			callback(textInfoData);			
		} else {
			loadTextsManifest(callback);			
		}	
	}

	function loadTextsManifest(callback) {
	
		var 
			textsFilename = 'texts.json',
			queryData = stringUtility.parseQuerystring();
		
		if (queryData['textlist']) {
			textsFilename = queryData['textlist'];
		}
		
		$.ajax({
			url: locationBase + textsFilename,
			dataType: 'json',
			cache: false,
			success: function(data) {
			
				textIds = data.textIds;
				textInfoData = data.textInfoData;
				
				if (callback) { 
					callback(textInfoData);
				}
			},
			error: function(jqXHR, textStatus, errorThrown) {
				//console.log('error loading texts.json'); //, jqXHR, textStatus, errorThrown);
				//console.log(textStatus);				
				
				var modal = new MovableWindow(600,250, 'Chrome Local Error');
				//modal.size(500, 200).center();
				
				modal.body.css({background: '#000', color: '#fff' }).html(
					'<div style="padding: 20px;">' + 
						'<p>Windows, Start, Run</p>' +
						'<code>"%UserProfile%\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe" --allow-file-access-from-files</code>' +				
						'<p>Mac, Terminal</p>' +
						'<code>/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --allow-file-access-from-files</code>'+ 
					'</div>'
				);
				modal.show();

				
			}
		});
	}
	loadTextsManifest();	
	
	var ext = {
		getText: getText,
		loadTexts: loadTexts,
		textData: textData	
	}
			
	return ext;
})();
{'fraction_non_alphanumeric': 0.15909537856440512, 'fraction_numerical': 0.007472959685349066, 'mean_word_length': 2.6199288256227757, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, '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': '4014751', 'n_tokens_mistral': 2266, 'n_tokens_neox': 1705, 'n_words': 331}