<commit_before>$(document).ready(function(){
	app.c.init();
	app.v.init();
	app.c.listeners();
})
/////////////////////////////////////////////////////////////////////////////////

var app={m:{},v:{},c:{}};

/////////////////////////////////////////////////////////////////////////////////

app.m.inspiration=false;
app.m.lexicon=false;
app.m.colors={};
app.m.colors.primary="#f37";
app.m.colors.secondary="#f67";
app.m.colors.grey="#555";

/////////////////////////////////////////////////////////////////////////////////

app.c.init=function(){
	app.m.metadata={"name":"<NAME>","version":"0.0.2"};
};

app.c.listeners=function(){

$("input#count").click(function(){
	var input=$("#input").val();
	var inspiration=$("input[type=text]#inspiration").val();
	var count=$("input[name=count]:checked").val();
	var division=$("input[name=division]:checked").val();
	if (parseInt(division)==1){
		division=true;
	}else{
		division=false;
	}
	//console.log(division);
	input=app.c.ziph(input,parseInt(count,10),division);
	
	var sortable=[];
	for (var key in input){sortable.push([key,input[key].count],input[key].translation);}
	sortable.sort(function(a,b){return b[1]-a[1];});
	
	var s=[];
	for (var i=0;i<sortable.length;i++){
		if (sortable[i]!==undefined){s.push(sortable[i]);}
	}
	sortable=s;
	

	app.m.lexicon=app.c.translate(input,app.c.phonemify(inspiration));
	app.v.glossary(sortable);
	
	
});

};

app.c.ziph=function(sample,n,spaces){
	var spaces=spaces||false;
	var n=n||1;
	var lex={};
	var sample=sample.toLowerCase();
	if (spaces==true){
		sample=sample.split(" ");
	}
	else{
		sample=sample.split("");
	}

	app.m.sampleLength=sample.length;

	for (var i=0;i<=(sample.length-n);i++){
		//then populate the lexicon
			var compilation=[];
			for (var j=0;j<n;j++){
				compilation.push(sample[i+j])
			}
			if (spaces==true){
				compilation=compilation.join(" ");
			}
			else{
				compilation=compilation.join("");
			}

		if (!lex[compilation]){
			lex[compilation]={};
			lex[compilation].count=1;
		}
		else{
			lex[compilation].count++;
		}
	}
	return lex;
};

app.c.translate=function(lexicon,phonemes){
	var s=[];
	
	console.log("lexicon");
	
	var i=0;
	for (var key in lexicon){i++;}
	console.log(i);
	
	var ps=[];
	while (ps.length<i){
		var nt=davis.pick(phonemes);
		while(ps.indexOf(nt)>-1){
			nt+=davis.pick(phonemes);
		}
		
		ps.push(nt);
		console.log(nt);
		ps=_.uniq(ps);
	};
	
	
	var i=0;
	for (var key in lexicon){
		var t=ps[i];
		s.push({source:key,count:lexicon[key],translation:t});	
		i++;
	};
	
	return s;
};

app.c.phonemify = function (inspiration) {
	var soft = [
		'c', 'f', 'h', 'l', 'm', 'n', 'r', 's', 'v', 'w', 'z', 'y'
	];
	var hard = [
		'b', 'c', 'd', 'g', 'j', 'k', 'p', 'q', 't', 'x', 'y'
	];
	var vowels = [
		'a', 'e', 'i', 'o', 'u', 'y'
	];
	var softp = inspiration.match(new RegExp('([' + vowels.join('|') + "]+["+ soft.join('|') + ']+)', 'gi')) || [];
	var hardp = inspiration.match(new RegExp('([' + vowels.join('|') + "]+["+ hard.join('|') + ']+)', 'gi')) || [];
	var softsoft = inspiration.match(new RegExp('([' + soft.join('|') + ']+[' + vowels.join('|') + "]+["+ soft.join('|') + ']+)', 'gi')) || [];
	var softhard = inspiration.match(new RegExp('([' + soft.join('|') + ']+[' + vowels.join('|') + "]+["+ hard.join('|') + ']+)', 'gi')) || [];
	var hardsoft = inspiration.match(new RegExp('([' + hard.join('|') + ']+[' + vowels.join('|') + "]+["+ soft.join('|') + ']+)', 'gi')) || [];
	var hardhard = inspiration.match(new RegExp('([' + hard.join('|') + ']+[' + vowels.join('|') + "]+["+ hard.join('|') + ']+)', 'gi')) || [];
	var default_ret = [
		'sa','so','si','da','do','di'
	];
	
	var ret = _.uniq([].concat(softp, hardp, softsoft, softhard, hardsoft, hardhard));
	
	if (ret.length < 1) {
		return default_ret;
	}
	
	return ret || default_ret;
};


app.c.phonemify_0 = function (inspiration) {
	var soft = [
		'c', 'f', 'h', 'l', 'm', 'n', 'r', 's', 'v', 'w', 'z', 'y'
	];
	var hard = [
		'b', 'c', 'd', 'g', 'j', 'k', 'p', 'q', 't', 'x', 'y'
	];<commit_msg>expanded the phonemify method to include naked vowels<commit_after>$(document).ready(function(){
	app.c.init();
	app.v.init();
	app.c.listeners();
})
/////////////////////////////////////////////////////////////////////////////////

var app={m:{},v:{},c:{}};

/////////////////////////////////////////////////////////////////////////////////

app.m.inspiration=false;
app.m.lexicon=false;
app.m.colors={};
app.m.colors.primary="#f37";
app.m.colors.secondary="#f67";
app.m.colors.grey="#555";

/////////////////////////////////////////////////////////////////////////////////

app.c.init=function(){
	app.m.metadata={"name":"<NAME>","version":"0.0.2"};
};

app.c.listeners=function(){

$("input#count").click(function(){
	var input=$("#input").val();
	var inspiration=$("input[type=text]#inspiration").val();
	var count=$("input[name=count]:checked").val();
	var division=$("input[name=division]:checked").val();
	if (parseInt(division)==1){
		division=true;
	}else{
		division=false;
	}
	//console.log(division);
	if (input.length>1000){input.length=1000;}
	input=app.c.ziph(input,parseInt(count,10),division);
	
	var sortable=[];
	for (var key in input){sortable.push([key,input[key].count],input[key].translation);}
	sortable.sort(function(a,b){return b[1]-a[1];});
	
	var s=[];
	for (var i=0;i<sortable.length;i++){
		if (sortable[i]!==undefined){s.push(sortable[i]);}
	}
	sortable=s;
	

	app.m.lexicon=app.c.translate(input,app.c.phonemify(inspiration));
	app.v.glossary(sortable);
	
	
});

};

app.c.ziph=function(sample,n,spaces){
	var spaces=spaces||false;
	var n=n||1;
	var lex={};
	var sample=sample.toLowerCase();
	if (spaces==true){
		sample=sample.split(" ");
	}
	else{
		sample=sample.split("");
	}

	app.m.sampleLength=sample.length;

	for (var i=0;i<=(sample.length-n);i++){
		//then populate the lexicon
			var compilation=[];
			for (var j=0;j<n;j++){
				compilation.push(sample[i+j])
			}
			if (spaces==true){
				compilation=compilation.join(" ");
			}
			else{
				compilation=compilation.join("");
			}

		if (!lex[compilation]){
			lex[compilation]={};
			lex[compilation].count=1;
		}
		else{
			lex[compilation].count++;
		}
	}
	return lex;
};

app.c.translate=function(lexicon,phonemes){
	var s=[];
	
	console.log("lexicon");
	
	var i=0;
	for (var key in lexicon){i++;}
	console.log(i);
	
	var ps=[];
	while (ps.length<i){
		var nt=davis.pick(phonemes);
		while(ps.indexOf(nt)>-1){
			nt+=davis.pick(phonemes);
		}
		
		ps.push(nt);
		console.log(nt);
		ps=_.uniq(ps);
	};
	
	
	var i=0;
	for (var key in lexicon){
		var t=ps[i];
		s.push({source:key,count:lexicon[key],translation:t});	
		i++;
	};
	
	return s;
};

app.c.phonemify = function (inspiration) {
	var soft = [
		'c', 'f', 'h', 'l', 'm', 'n', 'r', 's', 'v', 'w', 'z', 'y'
	];
	var hard = [
		'b', 'c', 'd', 'g', 'j', 'k', 'p', 'q', 't', 'x', 'y'
	];
	var vowels = [
		'a', 'e', 'i', 'o', 'u', 'y'
	];	
	var default_ret = [
		'sa','so','si','da','do','di'
	];
	
	var v = inspiration.match(new RegExp('(['+ vowels.join('|') + ']+)', 'gi')) || [];

	var psoft = inspiration.match(new RegExp('([' + soft.join('|') + "]+["+ vowels.join('|') + ']+)', 'gi')) || [];
	var phard = inspiration.match(new RegExp('([' + hard.join('|') + "]+["+ vowels.join('|') + ']+)', 'gi')) || [];
	var softp = inspiration.match(new RegExp('([' + vowels.join('|') + "]+["+ soft.join('|') + ']+)', 'gi')) || [];
	var hardp = inspiration.match(new RegExp('([' + vowels.join('|') + "]+["+ hard.join('|') + ']+)', 'gi')) || [];
	var softsoft = inspiration.match(new RegExp('([' + soft.join('|') + ']+[' + vowels.join('|') + "]+["+ soft.join('|') + ']+)', 'gi')) || [];
	var softhard = inspiration.match(new RegExp('([' + soft.join('|') + ']+[' + vowels.join('|') + "]+["+ hard.join('|') + ']+)', 'gi')) || [];
	var hardsoft = inspiration.match(new RegExp('([' + hard.join('|') + ']+[' + vowels.join('|') + "]+["+ soft.join('|') + ']+)', 'gi')) || [];
	var hardhard = inspiration.match(new RegExp('([' + hard.join('|') + ']+[' + vowels.join('|') + "]+["+ hard.join('|') + ']+)', 'gi')) || [];

	var ret = _.uniq([].concat(v,psoft,phard,softp, hardp, softsoft, softhard, hardsoft, hardhard));
	
	if (ret.length < 1) {
		ret= default_ret;
	}
	
	ret=_.sortBy(ret,function(n){return n.length});
	console.log(ret);
	return ret;
};


app.c.phonemify_0 = function (inspiration) {
	var soft = [
		'c', 'f', 'h', 'l', 'm', 'n', 'r', 's', 'v', 'w', 'z', 'y'
	];
	var hard = [
		'b', 'c', 'd', 'g', 'j', 'k', 'p', 'q', 't', 'x', 'y'
	];
{'fraction_non_alphanumeric': 0.3315690425782169, 'fraction_numerical': 0.006821924253116914, 'mean_word_length': 3.342696629213483, 'pattern_counts': {'":': 4, '<': 15, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3167017', 'n_tokens_mistral': 3627, 'n_tokens_neox': 3374, 'n_words': 551}