Alexa Recites The Jedi Code For Star Wars Day

By Holly Brockwell on at

Amazon's Alexa voice assistant is celebrating Star Wars Day tomorrow with some appropriately themed content and Easter eggs.

Commands include:

  • Alexa, play Star Wars music
  • Alexa, tell me a Star Wars joke
  • Alexa, what is the code of the Jedi?
  • Alexa, Star Wars or Star Trek?

She's also keeping track of the number of requests for Star Wars vs Star Trek content: apparently Star Wars is currently winning by two thirds to a third.

If you want to add even more of The Force to your Echo, 3PO-Labs made a skill that could answer Star Wars questions despite some impressively complex problems (Alexa doesn't recognise actual words half the time, never mind things like "Sarlacc.") It's not available to the public because of licensing issues, but the writeup makes for fascinating reading:

"Converting gibberish into Star Wars

Alright, so at this point we have user input which are English words, and we need to determine what Star Wars subject they're talking about.

Our first observation is that these English words do sorta sound like the Star Wars subject, sorta. So let's use that by doing phonetic matching against the list of possible subjects.

After a brief investigation, we settled upon using the Double Metaphone algorithm from the Apache commons-lang library. This follows a set of rules and reduces words down to a "phonetic version" of themselves.

    Death Star = T0STR
    Grand Moff = KRNTMF
    Grand Moff Tarkin = KRNTMFTRKN
    Sarlacc = SRLK
    Boba Fett = PPFT

    Grandma tarquin = KRNTMTRKN

We attempted exact matches, but found it performed poorly. So we cycled through all Star Wars subjects, and calculated a difference measurement between the user input and the subject. From the same Apache library we used the Jaro–Winkler distance measure - which compares two Strings and returns a similarity score.

So for the user input of "grandma tarquin", we got a metaphone value of KRNTMTRKN. And when looping through Star Wars subjects we got values like these:

    Death Star = 0.0
    Grand Moff = 0.88
    Grand Moff Tarkin = 0.98
    Sarlacc = 0.0
    Boba Fett = 0.45

Ah ha! Grand Moff Tarkin scored the highest! The user was probably asking about him!"

Read the whole nerdtastic thing here.

Do you think Amazon's Star Wars additions go far enough? What would you have liked to see – a new wake word to rival the Trekkies' choice of 'Computer,' perhaps? Let us know in the comments, young Padawans.


More Alexa Posts: