I wanted to do more than simply speculate about what the poem would sound like, so I tried to design a few algorithms that a poem generator would probably use. There is some math, but I promise it's not too bad. You can read the following paragraphs if this interests you, but I won't blame you if you just want to read the poems. The poems may not make much sense without basic understanding of the algorithms, though!
It's fairly safe to assume that the Artificial Intelligence will have access to databases that store rhyming words and number of syllables in words. It will be able to string together lines of desired syllable counts into rhyme schemes fairly handily (as these are all quantitatively governed aspects of poetry). The computer would be able to completely nail poetic structures like limericks, but may struggle on a word-by word basis. The more stylistic phrases and strings of words that make up a line will pose a significant challenge to any computer. It will likely need some sort of line generation algorithm. This will most likely take the form of a sentence generating program, with a poetic aspect thrown in. This "poetic aspect" will probably just tweak certain sentence generating parameters.
Unfortunately, modern sentence generators are far from flawless. Given words to use, sentence generators can fairly accurately construct the "most logical" sentence based on matching different parts of speech to sentence templates. The "poetic" parameter can simply alter the prevalence weighting of different sentence forms to favor more "poetic" ones. Nonetheless, polishing this technology would probably suffice for poem generation.
This leaves one key step: selecting words to feed into the sentence generator. Word selection would probably be based on the previous line's words. One method that I can envision is a word web type system, where each noun, verb, and adjective is linked to 10-20 (call this variable n) related words. If a word appears in the previous line, each of its linked words can have a 1/n chance of appearing in the next line, while the original word can have a 10/n chance. Furthermore, each word in the system has a slight chance of occurring, which introduces a new theme or idea to the poem. (Yes, I know this has the potential for uncontrolled word pool growth, causing near-infinite run-on sentences, but these are just rough parameters!). This will select verbs, adjectives, and nouns to use. It will also have a function to detect "characters" in the poem and will increase their probability for reappearance in subsequent lines. These values will be altered to favor rhymes, and the program will cut off words that exceed the desired syllable count. Pronouns, articles, conjugations (like tense), and conjunctions will have a preset occurrence density determined at the initialization of the poem generator, and will maintain this density throughout the poem.
Sadly, this is basically the groundwork for a successful poem generator, though it does employ the "intelligence" of the AI to comb databases. Unfortunately it fails to incorporate any sort of personality that an Artificial Intelligence would (hopefully) have. A basic implementation would be a weighting table of the AI's preferred words, or word pertaining to the AI's "interests," replacing the 1/n method for word selection. Of course, this is rather superficial (like all of this really, but converting poetry into numbers isn't easy :P). Nonetheless, a more thorough implementation would be significantly better in the personality department, especially if it reflected speech patterns. One crippling aspect of the algorithm is that it lacks the ability to link verbs with direct objects (and other sentence parts with one another). Hopefully, the AI would be able to identify sentence fragments commonly used together and link them. If it were really "intelligent," It would probably know basic fundamentals of human communication anyway, but who can be certain?
Of course, this poem generator algorithm is far from perfect. Besides the fact that several critical functions remain designed, I don't have the programming experience to actually implement this, Nonetheless, I built a few sample poem (calculating everything by hand over and over because I sadly can't program). For the designed algorithms, I simulated results as realistically as I could, but didn't presume AI personality or anything of that sort (because I don't really know how to!). I also found that the syllable constraints tended to impair logical sentence generations, so I removed the syllable parameters on these poems. Here are my three favorites:
Two Homeless Amoeba
Two homeless amoeba drive through a crispy sparrow's house.
Eight starving hummingbirds locate their horsepower.
The swimmers' desperate shrubs amply rescue the deer mouse
We place the alarmed tower
Herbaceous Rations
We happily take Herbaceous rations
We happily steal bulbous calories
We apologetically cheat perennial actions
I remorse for our allergies
Blitzkrieg
Blitzkrieg removes mangoes without telekinesis
Psychic superboy's abilities filter the raspberries
You rarely impair Earth's cytokinesis
Bayesian plankton ripple in your prairies.
Eight starving hummingbirds locate their horsepower.
The swimmers' desperate shrubs amply rescue the deer mouse
We place the alarmed tower
Herbaceous Rations
We happily take Herbaceous rations
We happily steal bulbous calories
We apologetically cheat perennial actions
I remorse for our allergies
Blitzkrieg
Blitzkrieg removes mangoes without telekinesis
Psychic superboy's abilities filter the raspberries
You rarely impair Earth's cytokinesis
Bayesian plankton ripple in your prairies.
Online programs I used to make theses:
https://www.random.org/ (standard random number generator)
http://semantic-link.com/ (gives lists of words related to user input)
http://www.rhymezone.com/ (gives lists of words that rhyme with user input)
http://www.textfixer.com/tools/random-words.php (generates random words used in the first sentence)
https://www.random.org/ (standard random number generator)
http://semantic-link.com/ (gives lists of words related to user input)
http://www.rhymezone.com/ (gives lists of words that rhyme with user input)
http://www.textfixer.com/tools/random-words.php (generates random words used in the first sentence)
Concluding thoughts: Most ended up sounding like a particularly bad Mad-Lib, undoubtedly from the lack of sentence component linkage algorithms (which would be present in the real deal). Clearly the algorithms were a little bit underdeveloped, but I had fun trying to optimize as best I could without a ton of data to work off of. I also found that incidents where a single word triggered multiple related words for the next line tended to improve the logic of the poem. As such, the algorithm should probably be modified to: given a certain probability of triggering a related word, increase the subsequent likelihood of further triggering related words. Of course, the initial probability would have to be a lot less than 1/n to compensate.
I'm sure this post was fairly confusing, but I tried to my best to cover my thought process throughout the whole project. If this didn't make any sense to you, hopefully you enjoyed the silly poems.
I'm sure this post was fairly confusing, but I tried to my best to cover my thought process throughout the whole project. If this didn't make any sense to you, hopefully you enjoyed the silly poems.