Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Perl Poetry, Verse, Lyrical Modules?

by Dragonfly (Priest)
on Apr 06, 2002 at 06:47 UTC ( #157130=perlquestion: print w/replies, xml ) Need Help??
Dragonfly has asked for the wisdom of the Perl Monks concerning the following question:

Hello, my friends.

I've been considering embarking on a small A.I. project recently, and have been trying (though not very extensively, I admit) to determine the current state of the art in generating lyrical content or poetic verse, and wondering if this is possible by utilizing Perl's powerful text abilities.

Aside from a somewhat cryptic module on CPAN, and a few miscellaneous "Perl Poetry Generators" online here and there, I haven't been terribly successful in finding anything that might fit my needs. What I would like to do, eventually, is create a module that had the capacity to generate different styles of verse (i.e. haiku, the stanza, the sonnet, etc).

Does this sound like it would be interesting? Or has this already been accomplished and/or perfected? I would like to find an area of programming that still has a bit of the pioneering feel left, if possible.

Perhaps later I'd like to extend the module and add advanced features later on such as the ability to call use PerlVerse::Sonnet; or $third_verse = Stanza->new();, perhaps. There are many possibilities: if the Soundex algorithm (a la Knuth) was used with this application, it might be able to generate alliterative phrases or perhaps even complex rhythmic devices, which would further the likelihood of generating verse with a bit more "personality" and perhaps even the ability to fool a human being into thinking it was written by a real person.

Before I embark on this venture, I ask for your opinion as to the current state of the art, possible hurdles I would face, and whether or not you think this has been satisfactorily completed before, to ensure that I'm not unnecessarily reinventing the wheel. Basically, I am just asking for preliminary feedback at this point, or maybe trying to brainstorm for ideas from other Monks.

I am not even sure how feasible this sort of thing is, although my suspicion is that this would be much less painful to attempt to create using Perl than certain other languages. Does anyone here at PM have experience with this sort of thing? Would this be a good way for me to learn about linguistics, A.I., and in the process, attempt to write my first module? Or do you think I am wasting my time?

Replies are listed 'Best First'.
Re: Perl Poetry, Verse, Lyrical Modules?
by Zaxo (Archbishop) on Apr 06, 2002 at 07:26 UTC

    No expertise, but there is Lingua::Rhyme. Verse to convince a human needs to scan and make poetic sense. Another holy grail, have fun, best of luck!

    After Compline,

Re: Perl Poetry, Verse, Lyrical Modules?
by jryan (Vicar) on Apr 06, 2002 at 09:54 UTC
    You may find Coy, written by TheDamian, to be of quite some interest to you. In addition, many of the Lingua::* modules might be able to aide you in creation of your own poetry modules.
Re: Perl Poetry, Verse, Lyrical Modules?
by mattr (Curate) on Apr 06, 2002 at 18:20 UTC
    I think it's a great idea and not a waste of time. Consider that I don't know of another programming site that has a whole section just about Poetry! Something about Perl lends itself to it, and that might just be the part that makes it so satisfying and powerful. So your research could have a big impact on the rest of us too. (Of course a good poem does too.. I like Poe and Yeats a lot myself).

    No really, this seems to cover the fascinating fields of computational linguistics, and natural language processing, cognitive science, AI, semantics and text engineering. Run some searches!

    Some other links I found are this page about computer-generated poetry and text, and this other which has a bunch of poetry and related things on it. Didn't think #2 would have state of the art, though Kurzweil's program is listed. Oh and Google has a web directory related to this. Anyway.

    I do remember finding an online dictionary somewhere when I was looking at speech generation last year, you will need obviously a kind of lexicon. These exist and aren't a hurdle. Some other grammar programs are here.

    There is an online book about the state of the art 6 years ago.. here. But maybe you want to look at the Natural Language Software Registry which has a list of tools and refers to it. It would be very cool if you found something nice and made a CPAN module out of it so we can have fun with your work too! (Besides reading, er, the poetry.. :) And there is the OpenNLP and the GATE project which are open source.

    Finally you may wish to see Jordan Boyd-Graber's project on semantic poetry creation (pdf/txt). I hesitate to mention it as it seems to have been done just before college, but it appears to make poetry (no program, look at the evolutionzone link above for one), and he won $1000 from Intel a couple years ago for it which is impressive. Ah! I just looked at his bibliography and found the lexicon I remembered finding last year.. Princeton's WordNet. But be careful.. semantic poetry means just relying on dictionary meanings, no cliches or baggage as mentioned here and here. So getting a program to be expressive could be one of the hurdles, and one of the most interesting parts of the work.

    Maybe it would be good to take time out to study writing poetry without a computer too, in case you haven't. I'd imagine that your mind and sense of artistry and serendipity are going to be important to testing the software and following interesting clues.

    I like WordNet's definition of poetry.. "poetry -- (any communication resembling poetry in beauty or the evocation of feeling)". Perhaps this will give you the latitude you need to make something enjoyable and useful. I had fun looking at this stuff again. Good luck!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://157130]
Approved by grep
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2017-02-26 13:10 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (373 votes). Check out past polls.