This is an example of exact output. All formatting is done with python and is written into the code. More in depth explanation further below.
A Markov chain or Markov process is a theoretical model describing a sequence of possible events in which the probability of each event depends only on the state attained in the previous event. Informally, this may be thought of as, What happens next depends only on the state of affairs now.
Building the nested dictionaries necessary to iterate over each word in a text, tallying every word that follows it amd how many time almost broke my brain. Every word got its own dictionary containing the words that follow it and how many times. I then added the total count and used that to determine the weighted probability of each of the successive word. We then start the story with a random word, rerolling if its punctuation. We pull that words nested dictionary and, using the weighted probability, we rng the next word. Rinse and repeat until the story is as long as we want. Next, it runs through a recursive function designed to make sure each line (line is determined by when a period is called up) is no longer than 13 words, splitting at the middle comma, if there is one, and in the middle, if there isn't, capitalizing the first word in each and dropping the other down.