A funny text generator based on textgenrnn
Overview • How to use • Credits • License
GenIt is a command line tool that allows you to generate word sequences through machine learning on any text. It essentially uses textgenrnn to generate results and several APIs to collect data that will later be used for training. So you can have fun creating improbable tweets that Donald Trump could have written or inventing crazy quotes from the famous Oscar Wilde. There is no limit!
"DO NOT TOUCH" would probably be a phone
The wall is the only solution for our country! MAKE AMERICA GREAT A WALL!
Hulk of the Galaxy: Return of the Sith (Part II)
Currently, it is possible to collect subreddit's titles from Reddit, tweets from Twitter, quotes from Wikiquote and movies titles from IMDb. Local files are also supported if you want to experiment by yourself.
The program only works with version 3 of python (textgenrnn requires it) and uses several modules indicated at the top of the gen.py
script (which can be found in the source folder). Be sure to have them installed before running it:
import praw # https://praw.readthedocs.io/en/latest/
import prawcore # https://pypi.org/project/prawcore/
import twitter # https://developer.twitter.com/en/docs.html
import wikiquotes # https://pypi.org/project/wikiquotes/
import imdb # https://media.readthedocs.org/pdf/imdbpy/latest/imdbpy.pdf
from textgenrnn import textgenrnn # https://github.com/minimaxir/textgenrnn
from tqdm import tqdm # https://github.com/tqdm/tqdm
from pyfiglet import Figlet # https://github.com/pwaller/pyfiglet
from keras import backend as k # https://keras.io/
You will also need credentials if you want to retrieve data from Reddit or Twitter. Once you get them, create a config.py
file in the source folder, copy and paste the code below and fill in the fields with your codes:
# Reddit
reddit_client_id = 'YOUR_REDDIT_ID'
reddit_client_secret = 'YOUR_REDDIT_SECRET'
reddit_user_agent = 'YOUR_REDDIT_USER_AGENT'
reddit_username = 'YOUR_REDDIT_USERNAME'
reddit_password = 'YOUR_REDDIT_PASSWORD'
# Twitter
twitter_consumer_key = 'YOUR_TWITTER_ID'
twitter_consumer_secret = 'YOUR_TWITTER_SECRET'
twitter_access_token_key = 'YOUR_TWITTER_TOKEN_KEY'
twitter_access_token_secret = 'YOUR_TWITTER_TOKEN_SECRET'
Ater that, using this tool is quite simple. Just run the genit.py
script with the following command, then proceed as described in the shell:
python3 genit.py
The calculation time can be quite long, especially if you want to have consistent results. But don't worry, you won't be disappointed!
A huge thanks to Max Woolf for sharing his textgenrnn project! This is the basis of this tool.