2006-02-14

But this rhyme took me a little longer

Based on some suggestions from e-mailing readers, I rewrote the Ranyōshū program to make it slightly more contextually aware. It now calculates the next character based on:

  • The current ku (line)
  • The current position in the ku -- first character, middle character, or last character (or second-last character, if in the final ku)
  • The character that came immediately before.

In other words, the program's model of a waka is very simple: ABBBC, DEEEEEF, GHHHI, JKKKKKL, MNNNNOP. Given the character at position X and the type of character at position X + 1, it applies a little randomness to its list of possible successors (as observed in the Manyōshū itself) to select a character to fill position X + 1. (If there are no possible successors listed for the current situation, it defaults to "が".) This iterates until a complete waka has been created.

Since this approach means that we effectively ignore 10% of the Manyōshū data -- all the fragments, and any other waka that aren't in what eventually became the traditional 5-ku style -- Ranyōshū II has a smaller overall data set, but the finer gradation of position lets it create more varied and interesting works. For example, its Most Probable Composition is:

あきみのの
あらのはながね
さかぜをの
ころもがころは
いもあらなくに
Which I'm sure you'll agree is a lot more satisfying than chanting aranaku mo over and over again.

Oh, yeah, and I also took out the random break in the middle, since it interferes with free interpretation. Enjoy.

(P.S. The old version is still available, too.)

Popularity factor: 0


Comment season is closed.