<commit_before>(function(g,Ai) {
	if (typeof exports!="undefined") {
		//exports.strongEval=strongEval;
		exports=Ai;
	}else{
		g.Ai=Ai;
	}
})(this,(function() {
	function randomString(len, an){//comes from http://stackoverflow.com/a/27872144
		an = an&&an.toLowerCase();
		var str="", i=0, min=an=="a"?10:0, max=an=="n"?10:62;
		for(;i++<len;){
			var r = Math.random()*(max-min)+min <<0;
			str += String.fromCharCode(r+=r>9?r<36?55:61:48);
		}
		return str;
	}
	function lint(str,l){
		var elen=typeof l!="undefined"?l:str.length-1,index2;
		//find bad output
		var list=[],len,index,word;
		for (len=str.length; len>=1; len--) {
			if (!this.words[len]) this.words[len]={};
			for (index=0; index<(str.length-len); index++) {
				word=str.substr(index,len);
				if(!this.words[len][word]) this.words[len][word]=0;//value indicates how "good" a word is
				for(index2=0; index2<len; index2++) {
					if (!list[index+index2]) list[index+index2]=0;
					if (word>-1) {
						list[index+index2]++;
					}else{
						list[index+index2]--;
					}
				}
			}
		}
		//change bad output to good output
		for(index=0; index<list.length; index++){
			var tot=0;
			for(index2=0,slice=list.slice(index,index+elen); index2<slice.length; index2++) {
				tot+=slice[index2];//Find avarage of how "good" the "word" is at index with a length of elen
			}
			if ((tot/elen)<0) {//if word is "bad"
				word=randomString(elen);
			}
		}
		if (elen>=1) {
			return str;
		}else{
			return lint(str,elen-1);
		}
	}
	var Ai=function(name,obj) {
		/*
		There are 2 ways two run this function

			var myAi= new Ai("My AI's name");//1st
			var mySecondAi= new Ai("My 2nd AI's name",{
				//values here
			});//2nd
		*/
		if  (arguments.length===0||arguments.length>2) throw "The Ai constructor requires 1-2 values passed";
		obj=obj||{};//prevent bugs
		this.name=name;
		this.defaultResponces={
			"How are you?":"If you got this message, I am at least 25% operational.",
		};
		this.lastResponce="";
		this.words=[];
		this.context=[];
		this.inputTypes={
			string:function(str) {return str;},
		};
		if(typeof obj!="undefined") {
			for (var i in this) {
				if (typeof this[i]!="undefined") {
					for (var ii in obj[i]) {
						this[i][ii]=obj[i][ii];
					}
				}else this[i]=obj[i];//overwrite with obj
			}
		}
		/*if (typeof this.name!=="string") {
			throw "The name for your Ai bot must be a string";
		}*/
		this.reactTo=function(input,type) {
			/*
			How to use this function:

				var myAi= new Ai("My AI's name");
				var aisOutput=myAi.reactTo("input","usersname","type of input(optional but will use the typeof operator to determine this value if not specified)");
			*/
			var output="",len,index,word;//set varubles
			type=type||typeof input;

			//check varubles
			if (typeof this.inputTypes[type]==="undefined") {
				throw "Invalid type";
			}else{
				input=this.inputTypes[type](input);
			}

			//apply default responce
			if (this.defaultResponces.hasOwnProperty(input)) output=this.defaultResponces[input];
			//lint
			output=lint.call(this,output);
			//add to memory
			this.defaultResponces[input]=output;
			this.lastResponce=output;//For the punish and reward functions
			for (len=1; len<output.length; len++) {
				if (!this.words[len]) {
					this.words[len]={};
					this.context[len]={};
				}
				for (index=0; index<(output.length-len); index++) {
					word=output.substr(index,len);
					if(!this.words[len][word]) {
						this.words[len][word]=0;//value indicates how "good" a word is
						this.context[len][word]={
							before:[output.substr(index-len,len)],
							after:[output.substr(index+len,len)],
						};
					}else{
						this.context[len][word].before.push(output.substr(index-len,len));
						this.context[len][word].after.push(output.substr(index+len,len));
					}
				}
			}
			//act
			return output;
		};
		this.punish=function(str){
			if (typeof str=="undefined") {
				str=this.lastResponce;
			}
			for (var len=1; len<str.length; len++) {
				if (!this.words[len]) this.words[len]={};
				for (var index=0; index<(str.length-len); index++) {
					var word=str.substr(index,len);
					if(!this.words[len][word]) {
						this.words[len][word]=0;//value indicates how "good" a word is
					}else{
						this.words[len][word]--;
					}
				}
			}
		};
		this.reward=function(str){
			if (typeof str=="undefined") {
				str=this.lastResponce;
			}
			for (var len=1; len<str.length; len++) {
				if (!this.words[len]) this.words[len]={};
				for (var index=0; index<(str.length-len); index++) {
					var word=str.substr(index,len);
					if(!this.words[len][word]) {
						this.words[len][word]=0;//value indicates how "good" a word is
					}else{
						this.words[len][word]++;
					}
				}
			}
		};
	};
	return Ai;
})());
<commit_msg>Try to make recursiveness not overflow the stack :/<commit_after>(function(g,Ai) {
	if (typeof exports!="undefined") {
		//exports.strongEval=strongEval;
		exports=Ai;
	}else{
		g.Ai=Ai;
	}
})(this,(function() {
	function randomString(len, an){//comes from http://stackoverflow.com/a/27872144
		an = an&&an.toLowerCase();
		var str="", i=0, min=an=="a"?10:0, max=an=="n"?10:62;
		for(;i++<len;){
			var r = Math.random()*(max-min)+min <<0;
			str += String.fromCharCode(r+=r>9?r<36?55:61:48);
		}
		return str;
	}
	function lint(str,l){
		//define varubles
		var elen=typeof l!="undefined"?l:str.length-1,index2;
		//find bad output
		var list=[],len,index,word;
		for (len=str.length; len>=1; len--) {
			if (!this.words[len]) this.words[len]={};
			for (index=0; index<(str.length-len); index++) {
				word=str.substr(index,len);
				if(!this.words[len][word]) this.words[len][word]=0;//value indicates how "good" a word is
				for(index2=0; index2<len; index2++) {
					if (!list[index+index2]) list[index+index2]=0;
					if (word>-1) {
						list[index+index2]++;
					}else{
						list[index+index2]--;
					}
				}
			}
		}
		//change bad output to good output
		for(index=0; index<list.length; index++){
			var tot=0;
			for(index2=0,slice=list.slice(index,index+elen); index2<slice.length; index2++) {
				tot+=slice[index2];//Find average of how "good" the "word" is at index with a length of elen
			}
			if ((tot/elen)<0) {//if word is "bad"
				word=randomString(elen);
			}
		}
		if (elen>=1) {
			return str;
		}else{
			return lint(str,elen-2);
		}
	}
	var Ai=function(name,obj) {
		/*
		There are 2 ways two run this function

			var myAi= new Ai("My AI's name");//1st
			var mySecondAi= new Ai("My 2nd AI's name",{
				//values here
			});//2nd
		*/
		if  (arguments.length===0||arguments.length>2) throw "The Ai constructor requires 1-2 values passed";
		obj=obj||{};//prevent bugs
		this.name=name;
		this.defaultResponces={
			"How are you?":"If you got this message, I am at least 25% operational.",
		};
		this.lastResponce="";
		this.words=[];
		this.context=[];
		this.inputTypes={
			string:function(str) {return str;},
		};
		if(typeof obj!="undefined") {
			for (var i in this) {
				if (typeof this[i]!="undefined") {
					for (var ii in obj[i]) {
						this[i][ii]=obj[i][ii];
					}
				}else this[i]=obj[i];//overwrite with obj
			}
		}
		/*if (typeof this.name!=="string") {
			throw "The name for your Ai bot must be a string";
		}*/
		this.reactTo=function(input,type) {
			/*
			How to use this function:

				var myAi= new Ai("My AI's name");
				var aisOutput=myAi.reactTo("input","usersname","type of input(optional but will use the typeof operator to determine this value if not specified)");
			*/
			var output="",len,index,word;//set varubles
			type=type||typeof input;

			//check varubles
			if (typeof this.inputTypes[type]==="undefined") {
				throw "Invalid type";
			}else{
				input=this.inputTypes[type](input);
			}

			//apply default responce
			if (this.defaultResponces.hasOwnProperty(input)) output=this.defaultResponces[input];
			//lint
			output=lint.call(this,output);
			//add to memory
			this.defaultResponces[input]=output;
			this.lastResponce=output;//For the punish and reward functions
			for (len=1; len<output.length; len++) {
				if (!this.words[len]) {
					this.words[len]={};
					this.context[len]={};
				}
				for (index=0; index<(output.length-len); index++) {
					word=output.substr(index,len);
					if(!this.words[len][word]) {
						this.words[len][word]=0;//value indicates how "good" a word is
						this.context[len][word]={
							before:[output.substr(index-len,len)],
							after:[output.substr(index+len,len)],
						};
					}else{
						this.context[len][word].before.push(output.substr(index-len,len));
						this.context[len][word].after.push(output.substr(index+len,len));
					}
				}
			}
			//act
			return output;
		};
		this.punish=function(str){
			if (typeof str=="undefined") {
				str=this.lastResponce;
			}
			for (var len=1; len<str.length; len++) {
				if (!this.words[len]) this.words[len]={};
				for (var index=0; index<(str.length-len); index++) {
					var word=str.substr(index,len);
					if(!this.words[len][word]) {
						this.words[len][word]=0;//value indicates how "good" a word is
					}else{
						this.words[len][word]--;
					}
				}
			}
		};
		this.reward=function(str){
			if (typeof str=="undefined") {
				str=this.lastResponce;
			}
			for (var len=1; len<str.length; len++) {
				if (!this.words[len]) this.words[len]={};
				for (var index=0; index<(str.length-len); index++) {
					var word=str.substr(index,len);
					if(!this.words[len][word]) {
						this.words[len][word]=0;//value indicates how "good" a word is
					}else{
						this.words[len][word]++;
					}
				}
			}
		};
	};
	return Ai;
})());

{'fraction_non_alphanumeric': 0.1849432103729018, 'fraction_numerical': 0.014071766006633832, 'mean_word_length': 2.86708122813836, 'pattern_counts': {'":': 2, '<': 33, '<?xml version=': 0, '>': 13, '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': '147188', 'n_tokens_mistral': 4434, 'n_tokens_neox': 3556, 'n_words': 734}