Skip to content
πŸ“ A Markov chain sentence generator. Specify the file you want to analyse, sentence amount, word length, and you're ready to go.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Markov Text Generator

Python based text generator that uses the markovify python library.

Example data can be found in /data/input.jsonl. In this case, the data has been obtained from Twitter by using either Tweepy or twarc - All we care about is how the text corpus (body) is formatted. You're more than welcome to have a look at my Python Twitter Scraper using Tweepy for a basic implementation


  1. Load an input file (.jsonl) file with (ideally) more than 1000 sentences. More sentences help build stronger texts.
  2. Run create_text_body and specify the text_key to look for in your input file.
  3. Run create_markov_chain with your resulting text_body and pass in the state_size.
  4. generate_text will create a specific amount of sentences by a specified minimum and maximum length of characters. An output file is required, which is where we'll save our newly created sentences.

Quick links

You can’t perform that action at this time.