Tuesday, January 01, 2008
Does size really matter?
Nick Montfort sent me a perl program he's written, a 256-character poetry generator:
perl -le'sub w{substr("cococacamamadebapabohamolaburatamihopodito",2*int(rand 21),2).substr("estsnslldsckregspsstedbsnelengkemsattewsntarshnknd",2*int(rand 25),2)}{$l=rand 9;print "\n\nthe ".w."\n";{print w." ".substr("atonof",rand 5,2)." ".w;redo if $l-->0;}redo;}'
It runs anywhere perl is installed (Mac, Windows, Linux, etc.) Just copy the text and paste into a terminal window (or Windows command prompt window). It's pretty fast. Slow it down with this:
perl -le'sub w{substr("cococacamamadebapabohamolaburatamihopodito",2*int(rand 21),2).substr("estsnslldsckregspsstedbsnelengkemsattewsntarshnknd",2*int(rand 25),2)}{$l=rand 9;print "\n\nthe ".w."\n";{print w." ".substr("atonof",rand 5,2)." ".w;redo if $l-->0;}redo;}' | perl -pe'sleep(1);'
What's way cool about this is that it has all of the pieces text generation wants: document planner, micro planner, and surface realizer!
Comments:
<< Home
Jim, I'm very glad to read your reaction. Your discussions of ETC were very influential in my work here. I started with a crude approximation of unigram letter frequencies, a la Travesty by Hugh Kenner and Joseph O'Rourke, but quickly found that there needs to be more to a poetry generator, even one of this size. Whatever the destination is like, the journey was enjoyable for me. I may write more about the program in the future, and I may continue to develop it while maintaining the 256-character constraint.
Post a Comment
<< Home