marnanel: (Default)
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.
marnanel: (Default)
I've been thinking about the way Spurge works, and how it should be debianised.  Do any of you have strong opinions as to whether services whose traffic is not great should
  1. be launched from inetd or xinetd?
  2. listen for themselves?
  3. be able to do both, and the administrator can choose according to expected load?  This appears to combine the faults of both schemes.
Pros and cons:
  • The process is constantly running with (2), and not with (1).  Then again, if you're only running [x]inetd in order to run one service, you're running one extra process all the time anyway.
  • Configuration (by the user or the package) is far simpler with (2), especially because xinetd and inetd have different configuration file formats.
  • with (2), the service has to be capable of handling simultaneous connections in-house, whereas this isn't necessary with (1).
  • (1) has an extra dependency.
What are your thoughts?

I think bucktooth might be a vaguely comparable system to look at.  (It uses xinetd.)

Grogblog

Jul. 30th, 2009 03:32 pm
marnanel: (Default)
Nargery-filled thought experiment: It just occurred to me that with a very little amount of extra hacking I could simply implement my entire blog in Yarrow.  At a pinch, the system as it stands would work out of the box.  I still haven't found a CMS I really like, and Yarrow+RGTP is basically a very simple CMS, and I know it like the back of my hand.  Other things which would be useful if I did this:
  • possibly an option in the server so that only Editors (i.e. me) could create new items
  • RSS/Atom output from the web client; this would be fairly trivial to implement.  (Or do this externally to the web client, and only list items created by me; that way we wouldn't need to restrict the creation of new items.)
  • probably a magic option in the web client so that on that specific site the content of new items (but not the replies to them) was rendered as HTML rather than plain text; this would mean existing content could be kept as-is
  • skinning support, but if we switch to genshi as planned, this will be easy anyway
  • automatic crossposting to Dreamwidth (and thence to LJ) and GNOME Blogs; not sure at what level this would be best implemented; maybe on the server side as some kind of hook
  • I wonder whether we could have automatically-created accounts using OpenId somehow
It would actually be pretty nifty, all told.

Profile

marnanel: (Default)
Monument

May 2013

S M T W T F S
   1234
56789 1011
12131415161718
19202122232425
262728293031 

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 18th, 2013 08:08 am
Powered by Dreamwidth Studios