Generating Markov Chains from Subreddits

in python •  6 years ago 

download (1).png

Welcome back!

Today, I made a simple tool with PRAW and Markov chains, similar to the one I made with the Bitcoin whitepaper. Markov chains are mathematical systems that predict the next event in a sequence, which in this case, is a word. Effectively, it learns the patterns in which words are used to try to simulate language.

Setup

This requires a little bit of setup because you have to get a key for your script to access reddit's data through their tool, PRAW, but I think this approach is still the optimal one. You set this up, you have to visit the application page on reddit and hit 'create another app...'.

After creating your app, copy the client ID, which is under the name and type of the script, and the text labeled secret.

You also need to install praw for reddit, which you can do using pip:

pip install praw

Code

The code can be found here.

Results

I tried the BTC subreddit, and here are the results!

Good! youre a depiction of the definition of one week for you believe blockstreams

Sight. i thought i would anyone know someone on here is overly regulated same

$28. wtf gdax during my husband and all stellar

Mention bcc just toxic people call it as fuck is no legal terms and not a technical fields

Traction. even exists be investigating into coinbase has to me that you think the liberty dollar now i do this will be three years years now two step for like this would be spent the mempool space for complete bullshit

Ebay who can you take category satoshi electricity as my point sad theyre the option you couldnt understand technical understanding whats going so much less asphalt than you want a question is strength

Sweet. Check it out yourself and upvote below!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

DQmXotZZBTDKdUY4LdU5iTe6DWYWZi2Z3hWXk5V9TXbvVPG.png

Steem schools welcomes you to the steem blockchain.
Please join us at Steem Schools and get to meet over 5,000 great steemians and learn from their experience the basics of excelling on steemit. You equally stand a chance to get 50sbd from the school as support for our students. Here's the link
https://discord.gg/GcS23Vf