Older blog entries for marnanel (starting at number 884)

2 Apr 2011 (updated 2 Apr 2011 at 19:10 UTC) »

Nargery: How the triolet builder works

In case you're interested, here's how the triolet builder works.

We start by taking a set of words. Then we remove all the words which don't alternate between stressed and unstressed syllables. Next, we assign each of them a stress number whose absolute value is the number of syllables, and which is positive if the word begins on a stressed syllable and negative if it begins on an unstressed syllable. The stress numbers -1 and 0 are not allowed. Then we also assign each one a rhyme number, such that words with the same rhyme number rhyme. Here is the lexicon with stress numbers and rhyme numbers.

Next, we assign each word its most likely part of speech, as given in the Brown corpus tagset. If the word doesn't exist in that tagset, we throw it out. We use only the first character, so for example "NNS" is represented as "N". The part of speech gets concatenated with the stress number to form a "tag". For example, "N+3" is a three-syllable noun which begins on a stressed syllable, such as "cauliflower".

Then we make up a battery of phrases, each consisting of terminals (such as "if"), and nonterminals (such as "N" for noun). A script is then run over the battery to create all possible tags for the nonterminals which would fit into iambic tetrameter.

For example, this line, where R is a pronoun, A is an article, J is an adjective and N is a noun,

R are A J N

produces these arrangements. Note that R and A are constrained to be no longer than +1, and that A+1 is special-cased so that it cannot fall on a stressed syllable. Note also that we provide for both masculine (here, 8-syllable) and feminine (9-syllable) lines.

R+1 are A+1 J+1 N-4
R+1 are A+1 J+1 N-5
R+1 are A+1 J+2 N+3
R+1 are A+1 J+2 N+4
R+1 are A+1 J+3 N-2
R+1 are A+1 J+3 N-3
R+1 are A+1 J+4 N+1
R+1 are A+1 J+4 N+2

At runtime, we pick a random word from the lexicon, and select a list of words which rhyme with that word. Then for each word in the list, we note its tag, and find an arrangement that ends with that tag. We then proceed by matching nonterminals as appropriate. If after all this we find we don't have enough entries, we throw it all out and start again.

The back end is only polled twice, for the first and second lines. The rhymes for each are stored at the time. This is why all other lines will eventually loop around (as noticed by Sally and Simon).

All the lines we produce are logged and kept for a week. The front end can tell the back end to turn a triolet into a permanent post, but it can only do so for lines which exist in the log.

Syndicated 2011-04-02 18:09:01 (Updated 2011-04-02 18:19:54) from Monument

Song of Lent


O Lord, withhold your wrath against my wrong!
Be merciful to me - I faint and fail.
My vision draws to darkness, and I wail:
How long until you rescue me? How long?
Still groaning, since my strength is spent with groans,
By night I weep until I drench my bed,
My sight grows dim from sorrowing and dread,
My pains absorb my spirit, sleep and bones.
My Father, turn and save us as you said!
Display your love declared to us of old:
No hearts or mouths can praise you once grown cold,
Nor any man remember you when dead.
Away! The Lord has heard me call his name!
And all my foes shall surely fall in shame.


Joel on Coal



joining the choir = awesome




Recessional hymn



When you made this planet,
you saw it at its best,
for a week you laboured
then brought it to a rest;
you designed the whole creation
to rest and labour too,
and my Lord, I pray my life will mirror you.

When you walked this planet
you saw it at its worst,
and in all our troubles
you bore the burden first;
for you trod the path before us
in everything we do,
and my Lord, I pray my life will mirror you.

When you stir within us
you see us as we are;
as we face temptation
your word is never far;
for within our hearts you've written
your message through and through,
and my Lord, I pray my life will mirror you.


That meme





More triolets






triolets.org redesign

I finished the redesign over the weekend.


Thanks, everyone.




Diana Wynne Jones has died




triolets.org rethink








875 older entries...

New Advogato Features


