I made a bag of poems as a birthday gift for a friend using this code. All the poems are three words on three lines each, for a total of nine words. The words don't rhyme or have any particularly deep meaning and most of the poems end up being completely nonsensical. The original plan was to create haikus or something more elegant, but time constraints led to this solution. I hand picked a bunch of the poems, threw them in a word editor, corrected a lot of the weirder edge cases manually, printed out the poems, cut them out and put them in a small bag. The end result was a bag of poems, or a "poesipåse" in Swedish.
There is no elegance in the code, no Markov chains or machine learning, just random words being put together and an impressive collection of badly named and unused variables.
python dikt.py
starts it. Press enter to generate a new poem. You can comment out the last line to have it dump out poems based on the limit
variable.
någon adlad älg
bränner hopplöst städer
allt undrar vi