<commit_before>window.texts = window.texts || {};

texts.TextLoader = (function() {
	
	var data = {},
		baseFolder = 'content/texts/';
	
	function setBaseFolder(folder) {
		baseFolder = folder;
	}
		
		
	function load(textid, sectionid, successCallback, errorCallback) {
		
		if (typeof textid != 'string') {
			textid = textid.id;
		}
		
		
		// store texts during loading?		
		if (typeof data[textid] == 'undefined') {
			data[textid] = {};
		}
		
		if (typeof data[textid][sectionid] != 'undefined') {
			successCallback (data[textid][sectionid]);
		}
		
		var url = baseFolder + textid + '/' + sectionid + '.json?' + new Date();
		
		console.log(textid, sectionid, url);

			
		$.ajax({
			url: url,<commit_msg>trying to prevent loading a missing seciotn/chatper<commit_after>window.texts = window.texts || {};

texts.TextLoader = (function() {
	
	var data = {},
		baseFolder = 'content/texts/';
	
	function setBaseFolder(folder) {
		baseFolder = folder;
	}
		
		
	function load(textInfo, sectionid, successCallback, errorCallback) {
		
		var textid = '';
		
		if (typeof textInfo == 'string') {
			textid = textInfo;
		} else {		
			textid = textInfo.id;
			
			if (textInfo.sections.indexOf(sectionid) == -1) {
				//sectionid = textInfo.sections[0];
			}
						
			console.log('hasit', sectionid, textInfo.sections.indexOf(sectionid), textInfo.sections[0]);
		}
		
		
		// store texts during loading?		
		if (typeof data[textid] == 'undefined') {
			data[textid] = {};
		}
		
		if (typeof data[textid][sectionid] != 'undefined') {
			successCallback (data[textid][sectionid]);
		}
		
		var url = baseFolder + textid + '/' + sectionid + '.json?' + new Date();
		
		console.log(textid, sectionid, url);

			
		$.ajax({
			url: url,
{'fraction_non_alphanumeric': 0.15841013824884792, 'fraction_numerical': 0.0017281105990783411, 'mean_word_length': 3.1455847255369926, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5072596', 'n_tokens_mistral': 697, 'n_tokens_neox': 569, 'n_words': 123}