Skip to content

mbichoffe/markov_chains_twitter

Repository files navigation

Markov Chains Tweet Generator

A Markov Tweet Generator can be used to randomly generate (somewhat) realistic sentences, using words from a source text (like someone's tweet history). Words are joined together in sequence, with each new word being selected based on how often it follows the previous word in the source document. The results are often just nonsense, but at times can be strangely poetic.

Table of Contents⛓

Tech Stack

Frontend: HTML5, Jinja2, Bootstrap
Backend: Python, Flask
APIs: Twitter (Tweepy Library)

Features 🖇

Main Page

Main Page Logged out


Log in with Twitter (via OAuth)

Twitter Log In


Tweet one of the tweets generated via Markov Chains using Alice in Wonderland text:

Tweet Markov Chain


Or search for Twitter accounts to generate tweets using their timeline:

Search




Tweet the results! 🐦

Markov Chain Tweets

Setup/Installation ⌨️

Requirements:

  • pip
  • Twitter account
  • Python 2.7
  • Twitter API keys

To have this app running on your local computer, please follow the below steps:

Clone repository:

$ git clone https://github.com/mbichoffe/markov_chains_twitter.git

Create a virtual environment🔮:

$ virtualenv venv

Activate the virtual environment:

$ source venv/bin/activate

Install dependencies🔗:

$ pip install -r requirements.txt

Get your own secret keys🔑 for Twitter. Save them to a file secrets.sh. Your file should look something like this:

export TWITTER_CONSUMER_KEY="abc"
export TWITTER_CONSUMER_SECRET="abc"
export TWITTER_ACCESS_TOKEN_KEY="abc"
export TWITTER_ACCESS_TOKEN_SECRET="abc"

Load your secret info to your environment:

$ source secrets.sh

Run the app from the command line.

$ python server.py

TODO✨

  • Create database to store users and tweets
  • Complete mock api unittests

License

The MIT License (MIT) Copyright (c) 2017 Marina Bichoffe

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published