Package: markovmeme
Markov MemeWouldn't it be great to generate themed memes with Markov Models? Or just randomly
generated text? I think so too.UsageInstallYou can install from pypipipinstallmarkovmemeor install from the repository directly:$gitclonehttps://github.com/vsoch/markovmeme
$pythonsetup.pyinstallUsageYou can see the basic usage as follows. Basically, there is a "generate" command:$markov-memeusage:markov-meme[-h]{generate}...

MarkovMemeGenerator

optionalarguments:-h,--helpshowthishelpmessageandexitactions:actionsforMarkovMemeGenerator{generate}markovmemeactionsgenerategenerateamemeYou can see the corpus available by looking at the generate help:$markov-memegenerate--help
usage:markov-memegenerate[-h][--outfileOUTFILE][--fontsizeFONTSIZE][--font{OpenSans-Regular,Pacifico-Regular,Anton-Regular}][--corpus{hamlet,dr_seuss,trump_speech,the_office,office/stanley,office/toby,office/meredith,office/holly,office/creed,office/oscar,office/deangelo,office/david,office/dwight,office/kelly,office/phyllis,office/jim,office/nellie,office/gabe,office/clark,office/roy,office/karen,office/michael,office/andy,office/charles,office/kevin,office/pam,office/ryan,office/erin,office/robert,office/darryl,office/pete,office/jan,office/jo,office/angela}][--custom-corpusCUSTOM_CORPUS][--imageCUSTOM_IMAGE][--no-model]optionalarguments:-h,--helpshowthishelpmessageandexit--outfileOUTFILEtheoutputfiletosavetheimage(defaultstorandomlygeneratedpng)--fontsizeFONTSIZEfontsizeoftext(ifdesired)defaultsto16--font{OpenSans-Regular,Pacifico-Regular,Anton-Regular}choiceoffont(defaultstoopensans)--corpus{hamlet,dr_seuss,trump_speech,the_office,office/stanley,office/toby,office/meredith,office/holly,office/creed,office/oscar,office/deangelo,office/david,office/dwight,office/kelly,office/phyllis,office/jim,office/nellie,office/gabe,office/clark,office/roy,office/karen,office/michael,office/andy,office/charles,office/kevin,office/pam,office/ryan,office/erin,office/robert,office/darryl,office/pete,office/jan,office/jo,office/angela}thecorpustousetogeneratethememe,matchestoimages.--custom-corpusCUSTOM_CORPUSAcustomcorpusfile,fullpath--imageCUSTOM_IMAGEAcustomimagefile,fullpath--no-modelDon'tgenerateasentencefromcorpus,justrandomlyselectsentence.Random GenerationTo generate a meme from a random corpus, you can just run:$markov-memegenerateIf the randomly selected corpus doesn't have matching images, you'll seeNoimagesexistforcorpusoffice/clark.Pleasespecify--image.Corpus and Image SelectionAnd you can run the same command again, or specify a specific corpus and image.$markov-memegenerate--corpusoffice/michael--imagemarkovmeme/data/images/office/michael1.pngThe same can be done for specifying a custom corpus, which should be a text file with lines
to generate the model from.$markov-memegenerate--custom-corpusmarkovmeme/data/corpus/office/michael.txt--imagemarkovmeme/data/images/office/michael2.pngSkip ModelIf you don't want to use a model (and want real lines from some corpus) add--no-model$markov-memegenerate--no-modelInteractive PythonFor the most part, text size and number of characters are limited to fit reasonable within
1-3 lines. If you want to customize or otherwise play around with this, you can interact
with the class directly:frommarkovmeme.mainimportMemeImagefrommarkovmeme.textimportgenerate_text# corpus is absolute path, or relative to module's data/corpus foldercorpus="office/michael"text=generate_text(corpus=corpus,use_model=True,size=10)# Set image to full path, or None to select based on corpusmeme=MemeImage(image=None,corpus=corpus)# Add text generated, centered on topmeme.write_text(text,fontsize=args.fontsize,font=font)# Leave outfile as None to generate random namememe.save_image(None)SupportDo you have a question? Or want to suggest a feature to make it better?
Pleaseopen an issue!