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.

License

Notifications You must be signed in to change notification settings

timrodz/python-markov-text-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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

How-to

  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

About

๐Ÿ“ A Markov chain sentence generator. Specify the file you want to analyse, sentence amount, word length, and you're ready to go.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages