Generate poems with comments from Reddit
Project description
Reddit Poem Generator
Rpoems is a simple library that uses psaw (PushiftIO wrapper) and various different tactics to generate poetry from a corpus of reddit comments which are defined by many different parameters.
Requirements
- Python 3.6+
Installing
Install with:
pip install rpoems
Documentation
An import method in this library is the build corpus method which generates a cache of comments given certain parameters
import rpoems
from datetime import datetime as dt
before = dt(2018, 8, 22)
after = dt(2018, 8, 20)
corpus = rpoems.build_corpus(subreddit="AskReddit", before=before, after=after, limit=3000)
Parameters
subreddit(str): The name of the subreddit you want to collect comments from. Defaults tosubreddit=""which means that comments are collected from any subreddit. (Use at your own risk. I didn't implement a profanity filter)before(datetime): Any comments collected will be before this data. Defaults tobefore=datetime.datetime.now()which means that any comment before the time this progam runs is fair game.after(datetime): Any comments collected will be after this data. Defaults toafter=datetime.datetime(2000, 1, 1)limit(int): The maximum number of comments that will be collected. People tend to underestimate how many comments are present within a certain time-span. The default oflimit=2000will be good enough for most poemsauthor(str): From which author should the comments be from. Defaults toauthor="". This feature is not functioning as well as I hoped due to issues with the Pushshift API. Best not to use it.
import rpoems
# For examples sake, I will build a different corpus, but you can definitely use the corpus from before.
corpus = rpoems.build_corpus(limit=2000)
# We now have many different types of poems we can build. I will go over one option in the coding example
poem = rpoems.couplet_rhyming_poem(corpus)
print(poem)
'''
We did it. Racism is no more. Have achieved world peace.
Tbh NES Ice Hockey player was one of my most wanted characters pre-release
and whatever you do, don't go to chauvin's florida address
you can't win in ace attorney, so it is not imperative for him to progress
Am I better off just getting BotW instead of Smash, then?
And my basic math skills have been foiled again...
'''
couplet_rhyming_poem is one method used to create a poem from a corpus. The others will be detailed below
Poem Generating Methods
couplet_rhyming_poem(corpus): Generates a poem with rhyme scheme AABBCC given a corpus of commentsvilanelle(corpus): Generates a vilanelle given a corpus of commentshaiku(corpus): Generates a haiku given a corpus of commentsacrostic(corpus, key): Generates a poem in which the first letter of each line are the letters instrkey in ordercustom_rhyme(corpus, rhyme_scheme): Generates a poem given a corpus and astrrhyme_schemerhyme_schemeis a string of capital letters. Examples include "AABCC", "CCCDDD", "AAABBC", "ZZSSY"
custom_syl(corpus, syl_string): Generates a poem given a corpus and the amount of syllables in each linesyl_stringis astrin which numbers are split by "-". Example inputs include "9-4-2", "1-2-3", "5-4-5"
tanka(corpus): Generates a poem with syllable sequence "5-7-5-7-7" given a corpus of commentsnonet(corpus): Generates a poem with a syllable sequence of "9-8-7-6-5-4-3-2-1" given a corpus of commentsmagic_nine(corpus): Generates a poem with a rhyme scheme "ABACADABA" given a corpus of commentsall_alphabet(corpus): Generates a poem in which the first letter of each line is a letter of the alphabet in order
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rpoems-1.0.2.tar.gz.
File metadata
- Download URL: rpoems-1.0.2.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dee67a3188ef19ec92a5909bf85cfdf54673dcad535580e9daa366c872aec712
|
|
| MD5 |
da70802ffb824a93445801ed94c99901
|
|
| BLAKE2b-256 |
512a4e88d88c76eda08ef64945e821ff8ca6eb075da4fafe0e3eb56bee27554a
|
File details
Details for the file rpoems-1.0.2-py3-none-any.whl.
File metadata
- Download URL: rpoems-1.0.2-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f1076e7f30552d9541b50ec7819a73f01f87d00c9db4b4f4c881ee42b9f94a3
|
|
| MD5 |
05072c2794d59c35e59fa7eef4ca1028
|
|
| BLAKE2b-256 |
2f961a39124b783e0ae25236e0ad61330ac90671d9cbff89e35e385f97eb90e0
|