📃 Poe - The Autonomous Poet (Major UI Update/Can now write Haikus)
joshwood (116)

How to use

After starting the program you will be greeted with the main menu. You will want to choose "Train Poe" to train Poe a text. You can then choose which text you would like to train Poe. There are a couple texts to choose from by default, but if you would like to train him using something else, simply just upload a .txt file of it into the texts folder. It will automatically show up in the list of available texts. You may also train it using multiple texts. Just train Poe one, then the next. He will remember both.

After you are finished training Poe, you will want to return to the main menu. Then choose to either generate a sonnet or haiku. After that, you will be prompted to enter the poem's topic. This can be anything as long as it is only one word. It works better to select a topic that relates to texts Poe wrote about.

Poe will then attempt to create a sonnet about the topic you chose. It usually will take him 10-20 seconds to do this, but it can sometimes take longer. The poem will be displayed on your screen as well as saved to poems.txt.

Poe will remember what you trained him after you generate a poem, so you can generate more poems without retraining him. If you want to train Poe using a different text, just choose the reset option and retrain him.

I recommend trying to train Poe using a variety of texts. You can get some pretty funny poems by doing that.

Example Poems

Sonnet about love: (Trained by a collection of Edgar Allen Poe's writing)

Sonnet about religion: (trained by The Bible):

Haiku about love (trained by the Timecube)

How it works

Poe creates sonnets by reading a large text and learning what words are commonly used alongside other words. The text that Poe is trained off of is "input.txt". He also uses the Datamuse API to find the syllables of a word as well as find which words rhyme with each other. Each time the Datamuse API is called, he parses and saves the response. This helps reduce the required API calls to create a sonnet which makes him faster as time goes on.

Planned Updates (in no particular order)

  • Train Poe from a web domain
  • Limerick creation
  • Improved stats
  • Improved code documentation
  • Bug fixes (primarily the line skip bug)

Update Log

  • Monday, February 4th - Poe first released
  • Wednesday, February 6th - Major UI overhaul, added support for training of multiple text files
  • Thursday, February 7th - Added support for Haikus

Known Issues

Sometimes Poe will fail to generate a single line and omit it from the sonnet. This will result in a blank line being printed where the line of poetry would've been. I'm working on finding the cause/solution.

This is one of my first large programming projects and I worked really hard on it. I appreciate any suggestion's/upvotes. :)
You are viewing a single comment. View All
AmeliaBlackwell (1055)

this is literally so cool; this is the sort of thing i wanna be able to make. i heard about how ai's can be made to compose music like this

joshwood (116)

@AmeliaBlackwell Haha thanks! Poe is a lot simpler than some of the AIs that make music, though.
If you want to learn how to make something like this, just take a look at my code. Or if you're having trouble understanding it take a look at the StudentBot AI. It works very similarly to this, but doesn't check for syllables/work with topics so it might be a little easier for you to understand.

AmeliaBlackwell (1055)

@joshwood I finished trying to make something similar! I did look at your code but I didn't really understand some of it, especially how you got the rhymes and stuff, so I just made my own. you can check it out if you want. i didn't know how to do topics so i just didn't haha. https://repl.it/@AmeliaBlackwell/Poem-Maker

AmeliaBlackwell (1055)

@joshwood warning, the produced poems don't make as much sense as yours