Consonant Blends Finder

Initial and Final

by skibulk

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/FThompson/[email protected]/form-persistence.min.js"></script>
<form id="persist">
</form>

CSS

* {
  box-sizing: border-box;
}

input[type="checkbox"] {
  display: none;
}

label {
  display: inline-block;
  padding: 5px 10px;
}

input[type="checkbox"]:checked + label {
  background: lightgreen;
}

JavaScript

// Check Out: https://github.com/geoSkogen/syllablemill

console.clear();

var TextStatistics;

// Text Statistics ----------------------------------
// https://github.com/DaveChild/Text-Statistics

var TS = (function(glob) {
	
	function cleanText(text) {
		// all these tags should be preceeded by a full stop. 
		var fullStopTags = ['li', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'dd'];
		
		fullStopTags.forEach(function(tag) {
			text = text.replace("</" + tag + ">",".");
		});
		
		text = text
			.replace(/<[^>]+>/g, "")				// Strip tags
			.replace(/[,:;()\/&+]|\-\-/g, " ")				// Replace commas, hyphens etc (count them as spaces)
			.replace(/[\.!?]/g, ".")					// Unify terminators
			.replace(/^\s+/, "")						// Strip leading whitespace
			.replace(/[\.]?(\w+)[\.]?(\w+)@(\w+)[\.](\w+)[\.]?/g, "$1$2@$3$4")	// strip periods in email addresses (so they remain counted as one word)
			.replace(/[ ]*(\n|\r\n|\r)[ ]*/g, ".")	// Replace new lines with periods
			.replace(/([\.])[\.]+/g, ".")			// Check for duplicated terminators
			.replace(/[ ]*([\.])/g, ". ")				// Pad sentence terminators
			.replace(/\s+/g, " ")						// Remove multiple spaces
			.replace(/\s+$/, "");					// Strip trailing whitespace
			
		if(text.slice(-1) != '.') {
			text += "."; // Add final terminator, just in case it's missing.
		}
		return text;
	}
	
	TextStatistics = function TextStatistics(text) {
		this.text = text ? cleanText(text) : this.text;
	};
	
	TextStatistics.prototype.fleschKincaidReadingEase = function(text) {
		text = text ? cleanText(text) : this.text;
		return Math.round((206.835 - (1.015 * this.averageWordsPerSentence(text)) - (84.6 * this.averageSyllablesPerWord(text)))*10)/10;
	};
	
	TextStatistics.prototype.fleschKincaidGradeLevel = function(text) {
		text = text ? cleanText(text) : this.text;
		return Math.round(((0.39 * this.averageWordsPerSentence(text)) + (11.8 * this.averageSyllablesPerWord(text)) - 15.59)*10)/10;
	};
	
	TextStatistics.prototype.gunningFogScore =...