* * * * *

 “So bitchin' luck to little Dorothy and that chick companions. May they live
             long in their invisible country and be superhappy!”

It's amazing how a little Internet outtage can focus the mind. I finally
figured out what my NaNoGenMo 2018 (National Novel Generation Month) [1]
entry should be and I finished it just prior to the Internet coming back
online.

Years ago, I came across some programs that would translate text to some
vernacular, like Jive:

> It's amazin' how some little Internet outtage kin focus de mind. I finally
> figured out whut mah' Nashunal Novel Generashun Mond 2018 entry should be
> and ah' finished it plum prio' t'de Internet comin' back online. What it
> is, Mama!
>

Um … yeah … let's not speak of that one again, shall we? Good.

But I had some other ones too. One converted text to Valleyspeak [2], and
another one converts text to sound like the Swedish Chef [3]:

> It's emezeeng hoo a leettle-a Internet oooottege-a cun fucoos zee meend.
> Bork Bork Bork! I feenelly feegoored oooot vhet my Neshunel Nufel
> Genereshun Munt 2018 intry shuoold be-a und I feenished it joost preeur tu
> zee Internet cumeeng beck oonleene-a. Bork Bork Bork!
>

Um … okay, it's not as bad as Jive—it's not like I want to burn my eyes after
reading it so I'll use that one too.

My thought, which came after several failed attempts at coming up with a hook
for this years NaNoGenMo, is to “translate” one of the Oz books [4] (the
first one that exceeds 50,000 words—turns out it's _The Emerald City of Oz_
[5], #6 in the series) to Valleyspeak, but to have all the spoken parts
“translated” to Swedish Chef.

The original programs are written in lex [6] and I didn't feel like going
through the hassle of trying to combine the two properly. So I converted each
one to LPeg [7]. That will make it easier to combine the two. The Valleyspeak
program [8] was a straightforward translation into Lua [9] (um, pun
unintended).

The Swedish Chef [10] version however … it wasn't quite so easy. It took a
close reading of the lex man page to figure out what was going on with that
code (darn that lack of Intarwebs! <shakes fist at ISP (Internet Service
Provider)>). Then about an hour or two converting that to LPeg [11], what
with the backtracking and look-aheads going on in the original code.

Once both of those were working, I then set about combining the two [12]. The
first time I generated a “novel,” the translators flipped—at the start, it
was in Valleyspeak with speech in Swedish Chef, but about halfway through it
was in Swedish Chef with speech in Valleyspeak! Turned out there was some
speech that spanned paragraphs, and as per the American style, when that
happens, the trailing quote is left off the initial paragraph.

Some more fighting code, and I finally have my novel—_The Valley Girl of Oz,
Bjork Bjork Bjork_ [13].

So, until next year, read and enjoy.

[1] https://github.com/NaNoGenMo/2018
[2] https://en.wikipedia.org/wiki/Valleyspeak
[3] http://muppet.wikia.com/wiki/The_Swedish_Chef
[4] https://en.wikipedia.org/wiki/List_of_Oz_books
[5] http://www.amazon.com/exec/obidos/ASIN/1542766532/conmanlaborat-20
[6] https://en.wikipedia.org/wiki/Lex_(software)
[7] http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html
[8] https://github.com/spc476/NaNoGenMo-2018/blob/master/valley.l
[9] https://github.com/spc476/NaNoGenMo-2018/blob/master/valley.lua
[10] https://github.com/spc476/NaNoGenMo-2018/blob/master/chef.l
[11] https://github.com/spc476/NaNoGenMo-2018/blob/master/chef.lua
[12] https://github.com/spc476/NaNoGenMo-2018/blob/master/run.lua
[13] https://github.com/spc476/NaNoGenMo-2018/blob/master/TheValleyGirlOfOzBjorkBjorkBjork.txt

Email author at [email protected]