A webapp that Markov-generates poems from plaintext.
Setup:
Drop plain text sources in /generate/data/
as SOURCE_NAME.txt
.
pip install -r requirements.txt
(Virtualenv recommended.)
You will need to download the pronunciation dictionary once with python -c "import nltk; nltk.download('cmudict')"
or you will get the runtime error Resource cmudict not found.
Run with flask run
.
(May require some futzing with relative/absolute imports depending on setup.)
Browse to http://localhost:5000
to read poems!
Bumps ipython from 7.5.0 to 7.16.3.
d43c7c7
release 7.16.35fa1e40
Merge pull request from GHSA-pq7m-3gw7-gq5x8df8971
back to dev9f477b7
release 7.16.2138f266
bring back release helper from master branch5aa3634
Merge pull request #13341 from meeseeksmachine/auto-backport-of-pr-13335-on-7...bcae8e0
Backport PR #13335: What's new 7.16.28fcdcd3
Pin Jedi to <0.17.2.2486838
release 7.16.120bdc6f
fix conda buildDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
The poem template will be a little more general if it's able to interpret "stressed syllable", "unstressed syllable", and "a syllable where stress doesn't matter".
Specifically this would be a good step towards refactoring haiku generation (currently special-cased to hell)
The current setup only uses first-order Markov generation but some of the corpuses are more than large enough to support second-order (or more). Theoretically it's not a hard adjustment to make, it just gets a little tricky to reason about with going backwards and all.
Input a poem(/song/text), use the pronunciation dictionary to extract the syllable and/or rhyme pattern of the input, and then generate new words that fit the same scheme.
Inspired by https://twitter.com/Adason15th/status/1217554175841619968
Handling words the pronunciation dictionary doesn't know (e.g. "Brightside") could get tricky. A good first approach would be to use the "syllable guess" function to estimate the number of syllables. It could be a fun rabbit hole to try to interpret the syllable pattern of a word based on the rest of the line and the lines around it. It could be another fun rabbit hole to specifically handle compound words.
Once upon a time I made some rudimentary attempts at getting this repo to properly behave like a package, but it could use some improvements (e.g. relative/absolute imports are pretty iffy right now). It would be great, for example, to easily be able to generate poems from a REPL/the command line without needing to launch the web interface.
The generate code could also use a simplifying refactor in general to make it more understandable/usable.