A Markov Chain is a system that is capable of predicting (or “hallucinating”) future state based only on the current state. Because of the predictable patterns in language, his process lends itself well to generating strings of text that resemble the style of text that the chain has been “trained” on. Commonly, this is used in the field of machine learning to imitate written human language.
As an experiment in learning about Markov Chains and a demonstration in how simple it can be to construct a rudimentary chain in python, I wrote a simple python script that takes a bunch of Donald Trump’s tweets from 2016 that I downloaded from http://www.trumptwitterarchive.com/archive and trains a Markov Chain on the text. The chain then generates a series of sentences less than 140 characters long in the same style of writing. The project, which can be found here https://github.com/MatanSilver/markov-trump generated some of these gems:
https://t.co/3lUaSztKYx Ted Cruz is mathematically out of control.
#ThrowbackThursday #Trump2016 https://t.co/gFtspBViXe I will soon be making a big speech the night of the wonderful reviews of last night.
This is indeed a great honor to support our Veterans with you!
Will go back on for a great guy!
Join @mike_pence at the Grand Opening of my favorite places this morning, was unable to answer the call!
#Debate #BigLeagueTruth Hillary Clinton is not qualified.
A true honor to get it done anyway!
Quick stop in Johnstown, Pennsylvania, where jobs are being stolen by other countries.
I will be swamped!
When you can’t say it - but media misrepresents!
A truly great champion and a must read!
Will soon be taken from her last show for lack of ratings, is even worse TPP approved.
Great meeting with the rest of the @NYTimes.
It is a hypocrite!
Had great meetings with Republicans in the Republican version - amazing people!