Sitemap
Blockchain Engineer - Crypto Trading Bots

Blockchain Engineer - Crypto Trading Bots

@BlockchainEng on Twitter. Crypto Trading Bots Programmer. Blockchain Engineer. Crypto Investor - Trader. ICO Advisor. realestateblockchain1@gmail.com

Programming A Markov-Chain Based Reddit Bot

I have discussed Reddit Bots many times previously, and even developed a youtube video series course on the topic. I am constantly testing, iterating and expanding my ‘collection of bots’ which are publicly available through github so that anyone can create and test their ideas with a Reddit bot.

How To Create Reddit Bot in Python

My interest from these subject is due to the immense reach of a Reddit bot and the ease of implementation: just a bit of python code and a ‘cloud-based’ server for 24/7 access which would be almost impossible for a human (or even 100 humans) to duplicate — such as recreating the voice of a long-gone historical figure.

A recent post in r/RequestABot described the requested functionality of a ‘Jordan Peterson’ markov chain bot. For those unfamiliar, Jordan Peterson is a Canadian psychology professor who discusses literary figures such as Dostoyevsky and Carl Jung, and is quite controversial. The user Ash Olgon created a markov chain bot for any famous person, with current examples being Martin Luther King, Winston Churchill, and Jordan Peterson.

Markov Chains Explained

A ‘Markov Chain’ is a method for analyzing text (and other sequential, causal events), with the ability to recreate a similar text. Markov Chains accomplish this by, loading a text, and creating a word-by-word structure which determines which words follow a particular word. The Markov Chain can then create a similar-sounding text to the original by choosing a ‘seed’ word, and then randomly choosing words which followed that particular word in the original text.

Get Blockchain Engineer - Crypto Trading Bots’s stories in your inbox

Join Medium for free to get updates from this writer.

This implementation of the Markov Chain gave me the idea to add the a ‘famous’ Reddit User ‘a_poem_for_your_sprog’, who will randomly post beautifully written poems — or at least something close!

How To Create A Markov Chain Reddit Bot (Additionally — base upon Reddit User poem_for_your_sprog)

  • Fork & Download code from Ashalon — Will be merged after project completion (Side Note: After some testing, it was determined the original code were not markov chains. Code will be modified to be a Markov Chain before we proceed by utilizing Markovify code on Github)
  • Modify Previously Created ‘Reddit Comment Downloading Bot’ previously created, to download all (or large subset) of Sprog’s comment history into a text file (will eventually be able to download any user’s data) — Edited ‘Save_comments_to_spreadsheet.py’ code posted earlier.
  • add !sprog command and functionality to Markov Script to mimic and generate ‘poem_for_your_sprog’-type poems.
  • (Future) — Add ability for users to add their own ‘Markov Chain’ scripts to bot functionality (such as !AddMeToMarkovBot) which will then search, collect their comment history and then anyone can call !username to receive a Markov-based comment

Results of Markov-Chain based Bot

After completing this python project and testing the bot ‘in the wild’ (on Reddit), I am simply astounded at the effectiveness and quality of the Markov Bot’s ability to mimic/duplicate the voice, tone and subject matter of famous authors (such as Jordan Peterson).

Examples of Generated Markov-Chain Text Based on Historical/Philosophical Figures

Jordan Peterson:

If you act it out, at least initially, was that Communism, as an excuse, and it’s certainly counterproductive. He knows what might happen. There’s great power in that, then you don’t know who you’re messing with. You could think of something like a memory. He’s trying to make that real enough to make necessary sacrifices.

It doesn’t exactly seem like the ambiguity in the normative manner or if you’re kind of limit. I don’t really understand anything about the land where you’re punished for your virtues, in which case you’re very hostile and distrustful to people. That isn’t what I believe. One of the whole.

I think this is the last lecture-except, I talked to the conclusion that human beings have a desert. I’ve learned how to make of that. So we’re not going to negotiate with other people. You don’t forget it, because then you can journey towards, that’s more valuable than the world is a reference to the end of the Christian spectrum.

Martin Luther King, Jr:

Mine eyes have seen the glory of the fierce urgency of the unspeakable horrors of police brutality. When the architects of our nation until the Negro is granted his citizenship rights. We are saying that we will be the day when all of this nation.

Poem For Your Sprog:

While selecting a sentence to be tough -
For their eyes -
With a vow and a sandwich -
She was smiling when she found it,
He shook his head -
Not a murmur to be tough -
There were shadows in the kitchen -
So now you see
And he thought with a shake of her lace!

Karl Marx:

When the ancient world was in its last throes, the ancient world was in the modes of producing and appropriating material products, have, in the Middle Ages, which Reactionists so much admire, found its fitting complement in the domain of knowledge. This union is helped on by individual labourers, then by the other hand, theoretically, they have not got. When, therefore, capital is wage-labour. It is enough to mention the commercial crises that by their revolutionary combination, due to competition, by their fanatical and superstitious belief in the hands of the population, it was natural that writers who sided with the profane French literature. The distinguishing feature of Communism. The Communists, therefore, are on the continued existence of your own bourgeois form of property.

As you can see, the text generated is not 100%, can contain certain errors, but is remarkably cogent, powerful and unique to each particular writer (in full disclosure — I edited the program to mimic sprog’s style of placing each line on it’s own line in a more ‘lyrical/poetic’ pattern).

Future Research and Applications of Markov-Based Reddit Bot

Markov Chains are fascinating because, while not quite recreating an Author’s writing or developing new ideas, the generated text is remarkable in its lucidity and clarity, and very often creates complex and thought-provoking text. With the ability to create such powerful text, I believe it opens the ability to create ‘twitter’ accounts dedicated to literary figures (Mark Twain, Emily Bronte, Socrates, Plato) or even creating entire books, podcasts, etc. With new technologies such as AI (voice mimicing, visual effects) this becomes even more feasible.

  • Additional Historical/Philosophical Figures
  • Additional Writings by Current Figures

I have not completely finished the code for Markov-Based chain bot, however, and I will be updating it to github once I do. I had a great time with this bot, and I will continue to edit it in the future with an additional Youtube Video explaining the concept as well.

--

--

Blockchain Engineer - Crypto Trading Bots
Blockchain Engineer - Crypto Trading Bots