Sentence generation

robin's icon

Hi,

I'm working on a project with a poet who wants to make a 'Poetry Robot' - a hardware controller that the user can play and generate poetry with. I have a list of words that i"ve been busy organising into verbs, nouns, blah blah, and I have a few ideas about how to approach this with Markov chains and the like. Before I get too stuck in I wanted to ask if anyone has any prior experience of anything like this that they might be able to point me towards for a bit of research. I sense it will be a headache to programme the rules of the entire English language into Max, so I imagine a simplified set of rules will be the ultimate aim.

Any help/advice/obsvervations more than welcome

Robin

Brad Garton's icon

LISP was practically tailor-made for this kind of task. Check out the "bush-o-matic" demo that comes in [maxlispj] help patch:

It's a bit dated now, but the time of George W. isn't all that distant, unfortunately.

There are probably many other examples coded in LISP on the web. RACTER was one of my faves back in the olden days (check the wikipedia entry -- the policeman's beard is indeed half-constructed).

gusanomaxlist's icon

You also have the SuperCollider way:

"oh my".speak;

robin's icon

not really familiar with supercollider - what does that mean/do?

robin's icon

Thanks for the LISP stuff Brad. I'll have a look. What would be nice is some kind of abstract plan of a sentence generator, I imagine a table or web of transition possibilities.

gusanomaxlist's icon

robin wrote on Mon, 02 March 2009 15:30not really familiar with supercollider - what does that mean/do?

Sorry, couldn't resist...
The output would be a synthesized robotic voice saying "oh my". Generating strings and adding envelopes or fx would be kinda easier with that (at least for me)...

Anyway, your project sounds cool, I'm really curious to see what you come up with !

Ciao

robin's icon

aha! I suspected as much.

Unfortunately Supercollider has no poem generator built in then? That's a shame.

I'll probably post the results. I'm looking forward to getting stuck in. Right now I'm trying to learn the difference between intransitive and transitive verbs

gusanomaxlist's icon

robin wroteUnfortunately Supercollider has no poem generator built in then? That's a shame.

Unfortunately not =)

robin wrote
I'll probably post the results. I'm looking forward to getting stuck in. Right now I'm trying to learn the difference between intransitive and transitive verbs

Yes please !
Are you going the LISP RTCMix way ?

robin's icon

I think I'll stick with max, either with markov chains or pre-configured sentence patterns. Not sure yet. The words are all prerecorded, so all i need is a way to tell me what word type will fit logically with the previous words.

gusanomaxlist's icon

Sequence patterns and probability tables used with words types could also be cool.

Good luck!

Ciao

Jean-Francois Charles's icon

Maybe a context-free grammar would be enough for your project. Lisp is indeed a good language to deal with such sets of (dictionary + rules). Try to find a good tutorials on grammars, that should help you.
Jean-François.

Peter Castine's icon

Georg Bosch did a project like this years ago, although with ancient ImageWriters typing out the generated texts (a great sound, btw). Georg sometimes reads the list, but I've not seen him for a while.

There are a couple of tools in Max for doing Markov chains. Of course the factory anal/prob pair (be careful how you pronounce that!). Orm Finnendahl wrote a more extensive markov object that has unfortunately not been maintained for years (Orm is, I believe, off in Pd/Linux-land now). I have considered building something for Litter Power, but with Richard Dudas' tricks you can get enough mileage out of the factory objects that it's not been a high priority.

There are tons of Generative Text systems out in the world. Google a bit just to get some ideas on things you can do. You might even want to consider just using jit.uldl to connect to a Web-based app somewhere out there.

BTW, if you happen to need a simple scrambler or random permutation tool, the Litter Starter Pack includes reincarnations of the scramble and alea objects James McCarthy once wrote (and since orphaned)... look for lp.crabelms and lp.ale, respectively.

Once you've got your text, there are a couple of 3rd-party speech objects.

Hope this helps,
-- P.

Brad Garton's icon

I forgot I had an on-line version of the "bush-o-matic" demo:

I did it a few months after 9/11; like I said a little dated but still I get a kick out of it (especially the animated gif wavy flags...). It uses a set of simple grammar templates with a corresponding word database (really simple and small). The java code is a little "off" for contemporary browsers (the LH margin is a bit smashed), but I'm too lazy to fix it right now.