JSFiddle - React, Tailwind, and code Playground

by gwwar

HTML

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<form role="form">
    <div class="form-group">
        <label for="text">Test another phrase</label>
        <textarea id="text" class="form-control" rows="3"></textarea>
    </div>
<button id="submit" type="submit" class="btn btn-default">Generate Sentence</button>
</form>
<div class="row">
  <div class="col-md-12 result"></div>
</div>

CSS

form, .row {
   padding: 10px; 
}

JavaScript

(function() {
    
    "use strict";

    var seedText = "Won't somebody please think of the children! Won't somebody please think of all the people who spent their lives buying and reading Penguin Classics? Won't somebody please think of the hypothetical sight-impaired user who has not yet been offended against? Won't somebody please think of the language! The death toll from the American anti vaccine movement. Won't somebody PLEASE think of the rapist? Please, won't someone think of the um, never mind. We're just getting them ready for life in the New World Order! One more tiny step closer to the masses realising it's class war. Ok, so can we just go ahead and have the class war already? I didn't realise there was some sort of cake icing class war going on. This isn't class war. San Francisco's class war is getting ugly. What's climate change improving now? The Earth has a well documented history of climate change before people existed. Won't somebody think of the chemtrails! If you have nothing to hide you have nothing to fear. How are authorities powerless to stop her? The anti science and non science voices in this society threaten to kill us all. In our case, it is working well for 1% .  Interesting to me how both parties increased in the number of evolution deniers. Over a third of Dems are evolution deniers and that number has been growing. I'm not a climate change denier.";
    var terminators = [".", "?", "!"],
        isTeminator = function(token) {
            return !token || terminators.indexOf(token) !== -1;
        },
        frequencyMap = {},
        start = [],
        updateFrequencyMap = function(text) {
            var words, word, i;
            //replace punctuation other than periods
            text = text.replace(/[,;\(\)]/gi,"");
            text = text.replace(/\./gi," .");
            text = text.replace(/\?/gi," ?");
            text = text.replace(/\!/gi," !");

            words = text.split(" ");
            
            //make...