08 August 2010

More on Frink and the Iterative Translation Game

Yesterday I wrote a long post on Frink, a programmable calculator that is magnificently aware of units of measurement, in a way that your current calculator simply isn't.

That post ended with an introductory look at Frink's translation functions, and their use in the iterative translation game originally suggested by games with wordsI suggested that it would be simple to write a program in Frink to extend the number of iterations, but I left this as an exercise for my readers.

However, my readers were slow on the uptake, and since I was looking for a way to fritter away time last night (I was taking the day off from practicing), I couldn't help playing around with this myself.  Thus my two crude first-approximation programs.

The first uses Frink's own translation functions (the ones I used in yesterday's post):

while phrase=input["Enter test sentence: "]
{
n=input["Enter number of iterations: "]
i=0
    while i < eval[n]
    {
  
        phrase=Japanese[phrase] -> JapaneseToEnglish
        println[phrase]
        i=i+1
  
    }
}

The "intermediate" language here (Japanese) is hard-wired into the program (which is one of the reasons I call the program "crude"), but it is easy enough to change it. The eval[] function forces Frink to evaluate the input for "number of iterations" as an integer rather than a string.

The iterative results for Japanese using Frink's translation function can be wonderfully weird.  For example, here are the first 16 iterations for "Mary had a little lamb, whose fleece was white as snow":
  • The wool there was a white small lamb in Mary as a snow.
  • Then the wool was the lamb whose Mary is small white as a snow.
  • Then as for the wool Mary it was the lamb which is small white as a snow.
  • Then Mary's because of the wool those where it is small white as a snow were the lamb.
  • Then because the snow was the lamb, the place where it is the white where that is small because of the wool Mary those.
  • Then because the snow was the lamb, as for those that being small Mary's because of the wool the place where it is white.
  • Then small Mary is white because of the wool, assuming, that it is, because the snow was the lamb, because of those the place. 
  • Then because small Mary the snow was the lamb, that because of those which are something which has become the place so thing is white because of the wool which is supposed, is.
  • Then because small Mary was the snow lamb, it is that, that because some became the place and it is white because of the wool where therefore thing is supposed.
  • Then because small Mary was the lamb of the snow, therefore because part became the place, the fact that it is white because of the wool where that is supposed that is.
  • Then therefore because small Mary was the lamb of the snow, because the part became the place, the fact that it is white because of the wool where that it is supposed.
  • Then therefore because the part became the place, because small Mary was the lamb of the snow, the fact that that is white because of the wool which is supposed.
  • Then therefore because small Mary was the lamb of the snow, because the part became the place, the fact that it is white because of the wool where that is supposed.
  • Then therefore because the part became the place, because small Mary was the lamb of the snow, the fact that it is white because of the wool where that is supposed. 
  • Then therefore because small Mary was the lamb of the snow, because the part became the place, the fact that it is white because of the wool where that is supposed.
  • Then therefore because the part became the place, because small Mary was the lamb of the snow, the fact that it is white because of the wool where that is supposed.
Note that the translation reaches a kind of "repeating decimal," alternating between the last two states. Because I don't know how Frink's translation function works (you have to be connected to the Internet to use it), I have no idea why these results turn out as they do, although it's clear that these functions don't draw on Google Translate, as Frink has a separate function for that, translate[].

Here's my similar crude program using the  translate[] function.
while phrase=input["Enter test sentence: "]
{
n=input["Enter number of iterations: "]
i=0
    while i < eval[n]
    {
   
        phrase=translate[phrase,"en","ja"]
        phrase=translate[phrase,"ja","en"]
        println[phrase]
        i=i+1
   
    }
}

Again using "Mary had a little lamb...," it turns out that using Google Translate to Japanese and back will continually return the original sentence.

Provided, that is, that you don't forget the comma in the middle of the sentence.  The first time I ran the program, I forgot the comma, and got the following result:
  • Mary had a little lamb its fleece as white as snow.
  • Mary's little lamb, its fleece was white as snow.
  • Mary Lamb, its fleece was white as snow.
  • Mary Lamb, its fleece was white as snow.
which reaches equilibrium after three iterations.

And finally, the opening sentence from Pride & Prejudice, run iteratively through Google Translate to Japanese and back, which reaches amusing equilibrium after 5 iterations:
  • Truth universally acknowledged that the wife must have selected a man possessed of good fortune.
  • Is a universal truth, admitted that his wife should be held to select a lucky guy.
  • Universal truth, it is acknowledged that his wife should be held to select the best.
  • Universal truth is that his wife should have accepted to host the best choice.
  • Universal truth, his wife should have accepted to host the best choice.
  • Universal truth, his wife should have accepted to host the best choice.
I could spend the whole day playing with this, but it's time for breakfast...

[UPDATE: OK, I admit it, I'm an addict. I couldn't stop. But this one is too good not to add.

Here's the iterative Google translation to Japanese and back of the first sentence of Nabokov's Lolita, "Lolita, light of my life, fire of my loins.":
  • My waist Lolita, light of my life, fire.
  • Lolita my waist, my life, light the fire.
  • Lolita back my life, fire light.
  • My life back to Lolita, light of fire.
  • Back to my life Lolita, light of fire.
  • Back to the top of my life Lolita, light of fire.
  • Lolita my life back to the top of the light of fire.
  • Light the fire on my life back to Lolita.
  • Lolita is a light in my life to fight back.
  • Lolita is a light in my life to fight back.
This reaches equilibrium after 9 iterations.]
Bookmark and Share

1 comment:

  1. My old roommate and I once played with Windows speech recognition. I trained it to my voice, and it was actually much better than I expected.

    The fun began when I'd dictate a text, then my roommate would dictate the results of its transcription of my dictation. We started with this quote from a New Yorker article:

    "When a show succeeds, especially if it involves a collaboration, the story of its origins becomes the greatest fiction of all. Bernstein called 'West Side Story' 'my baby'; Robbins, to whom no one was speaking by opening night, signalled his imperialism over the enterprise by contractually requiring a box around his billing in every production of the show."

    After 7 cycles, it ended up as this:

    "Sixteen-one, $19.00 and cents per year, most recent ones are scenes that is, saying he was senior has been sterilized seems as soon as"

    We were being deliberately mean to it, forcing it to use training to my voice to transcribe my roommate's voice, and incorporating its errors into the next round of text.

    We were highly amused by the whole process and did several of them.

    I think we were drinking cocktails at the time, too. :)

    --
    David W. Fenton
    http://dfenton.com/NoComment/

    ReplyDelete