Skip to content

BriChavez/seuss_markov

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Seuss



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 Peek Into How Markov Works

Markov Chain Simple Graph

  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.





Markov Chains Clearly Explained! Part - 1




Example of what the created dictionary looks like using Red Fish, Blue Fish

Explanation

Brief break down of the nuances of my code.

  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.






Markov Scatter Graph

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published