Markov Chains

Definition

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.

Project

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:

I like your lies.
Crooked Hillary is too easy!
Tickets: https://t.co/iwEAiWKgtR https://t.co/lLyaW6nxsP President Obama ever discuss the real world!

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.

Video: https://t.co/fJw8Ax7E8P https://t.co/ZDbarevYAc The Club for Growth letter- trying to belittle.

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!

MAKE AMERICA SAFE AGAIN! https://t.co/m0AJWlV8nm https://t.co/P0GleHEmJy Isn’t it sad that Republicans would allow this to be a great time!

Had great meetings with Republicans in the Republican version - amazing people!

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×