{"id":17030327,"url":"https://github.com/vsoch/markovmeme","last_synced_at":"2025-04-23T20:14:23.037Z","repository":{"id":48714396,"uuid":"230801748","full_name":"vsoch/markovmeme","owner":"vsoch","description":"Generate memes using Markov Models","archived":false,"fork":false,"pushed_at":"2021-07-13T13:09:54.000Z","size":85209,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T03:04:01.203Z","etag":null,"topics":["generator","markov","meme","python"],"latest_commit_sha":null,"homepage":"https://vsoch.github.io/markovmeme","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vsoch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-29T20:48:53.000Z","updated_at":"2021-07-13T13:09:56.000Z","dependencies_parsed_at":"2022-09-18T03:41:52.262Z","dependency_job_id":null,"html_url":"https://github.com/vsoch/markovmeme","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fmarkovmeme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fmarkovmeme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fmarkovmeme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fmarkovmeme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vsoch","download_url":"https://codeload.github.com/vsoch/markovmeme/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249981680,"owners_count":21355558,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generator","markov","meme","python"],"created_at":"2024-10-14T08:06:16.833Z","updated_at":"2025-04-23T20:14:23.009Z","avatar_url":"https://github.com/vsoch.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Markov Meme\n\n[![PyPI version](https://badge.fury.io/py/markovmeme.svg)](https://pypi.org/project/markovmeme/)\n[![GitHub actions status](https://github.com/vsoch/markovmeme/workflows/ci/badge.svg?branch=master)](https://github.com/vsoch/markovmeme/actions?query=branch%3Amaster+workflow%3Aci)\n\nWouldn't it be great to generate themed memes with Markov Models? Or just randomly\ngenerated text? I think so too.\n\n![https://vsoch.github.io/markovmeme/assets/gallery/peachy-sundae-4573.png](https://vsoch.github.io/markovmeme/assets/gallery/peachy-sundae-4573.png)\n\nSee the pathetic gallery [here](https://vsoch.github.io/markovmeme/)  or continue reading\nto generate your own terrible memes.\n\n## Usage\n\n### Install\n\nYou can install from pypi\n\n```bash\npip install markovmeme\n```\n\nor install from the repository directly:\n\n```bash\n$ git clone https://github.com/vsoch/markovmeme\n$ python setup.py install\n```\n\n## Usage\n\nYou can see the basic usage as follows. Basically, there is a \"generate\" command:\n\n```bash\n$ markov-meme \nusage: markov-meme [-h] {generate} ...\n\nMarkov Meme Generator\n\noptional arguments:\n  -h, --help  show this help message and exit\n\nactions:\n  actions for Markov Meme Generator\n\n  {generate}  markovmeme actions\n    generate  generate a meme\n```\n\nYou can see the corpus available by looking at the generate help:\n\n```bash\n$ markov-meme generate --help\nusage: markov-meme generate [-h] [--outfile OUTFILE] [--fontsize FONTSIZE]\n                            [--font {OpenSans-Regular,Pacifico-Regular,Anton-Regular}]\n                            [--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}]\n                            [--custom-corpus CUSTOM_CORPUS]\n                            [--image CUSTOM_IMAGE] [--no-model]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --outfile OUTFILE     the output file to save the image (defaults to\n                        randomly generated png)\n  --fontsize FONTSIZE   font size of text (if desired) defaults to 16\n  --font {OpenSans-Regular,Pacifico-Regular,Anton-Regular}\n                        choice of font (defaults to open sans)\n  --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}\n                        the corpus to use to generate the meme, matches to\n                        images.\n  --custom-corpus CUSTOM_CORPUS\n                        A custom corpus file, full path\n  --image CUSTOM_IMAGE  A custom image file, full path\n  --no-model            Don't generate a sentence from corpus, just randomly\n                        select sentence.\n```\n\n### Random Generation\n\nTo generate a meme from a random corpus, you can just run:\n\n```bash\n$ markov-meme generate\n```\n\nThe library comes with images that are matched to each corpus (e.g., text generated with\nlines from Michael's the Office will display with an image of Michael Scott).\nIf the randomly selected corpus doesn't have matching images, you'll see\n\n```bash\nNo images exist for corpus office/clark. Please specify --image.\n```\n\nMost of the corpus should now have images so you are unlikely to see this.\n\n\n### Corpus and Image Selection\n\nAnd you can run the same command again, or specify a specific corpus and image.\n\n```bash\n$ markov-meme generate --corpus office/michael --image markovmeme/data/images/office/michael1.png\n```\n\nThe same can be done for specifying a custom corpus, which should be a text file with lines\nto generate the model from.\n\n```bash\n$ markov-meme generate --custom-corpus markovmeme/data/corpus/office/michael.txt --image markovmeme/data/images/office/michael2.png\n```\n\nHere is a loop to generate one meme per corpus (and matching image)\n\n```bash\nfor corpus in 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\n  do\n    markov-meme generate --corpus ${corpus}\ndone\n```\n\n### Skip Model\n\nIf you don't want to use a model (and want real lines from some corpus) add `--no-model`\n\n```bash\n$ markov-meme generate --no-model\n```\n\n\n## Interactive Python\nFor the most part, text size and number of characters are limited to fit reasonable within\n1-3 lines. If you want to customize or otherwise play around with this, you can interact\nwith the class directly:\n\n```python\nfrom markovmeme.main import MemeImage\nfrom markovmeme.text import generate_text\n\n# corpus is absolute path, or relative to module's data/corpus folder\ncorpus = \"office/michael\"\n\ntext = generate_text(corpus=corpus, use_model=True, size=10)\n\n# Set image to full path, or None to select based on corpus\nmeme = MemeImage(image=None, corpus=corpus)\n\n# Add text generated, centered on top\nmeme.write_text(text, fontsize=args.fontsize, font=font)\n\n# Leave outfile as None to generate random name\nmeme.save_image(None)\n```\n\n## Support\n\nDo you have a question? Or want to suggest a feature to make it better?\nPlease [open an issue!](https://www.github.com/vsoch/markovmeme)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsoch%2Fmarkovmeme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvsoch%2Fmarkovmeme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsoch%2Fmarkovmeme/lists"}