Skip to content

Generate random texts based on a collection of tweets, using Markov Chains.

Notifications You must be signed in to change notification settings

barryharmsen/markov-text-from-tweet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

markov-text-from-tweet

Generate random texts based on a collection of tweets, using Markov Chains. This example uses tweets from Donald Trump (@realdonaldtrump), which were downloaded from here. Just a little fun ;)

Files need to be stored in the 'tweets' subfolder.

Usage

Building the dictionary

Run generate_dict.py to generate the dictionary of word pairs

Generate a random text

Run random_text.py using the following parameters:

-wp or --wordpair, a pair of words to using as the starting point for the text. Example: -wp The President

-l or --length, the max number of words that should be generated

-d or --dict, the dictionary file to use. Defaults to dict.json

Example

Input: python random_text.py -wp President Obama -l 25

Result: President Obama & Democrat leaders did a nasty cartoon attacking @tedcruz kids Bad

About

Generate random texts based on a collection of tweets, using Markov Chains.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages