Macadamian Blog

Creating the Fantasy Scoreboards Alexa Skill

Martin Larochelle

We have officially submitted our second Alexa Skill for review. It’s called Fantasy Scoreboards and allows users to control their WiFi connected NHL scoreboard with their Amazon Echo. While building this Skill we learned a few more valuable lessons about extending the capabilities of Alexa.

Fantasy Scoreboards Alexa Skill

We have officially submitted our second Alexa Skill for review. It’s called Fantasy Scoreboards and allows users to control their WiFi connected NHL scoreboard with their Amazon Echo.

The Skill allows users to:

  • Set their favorite team
  • Show the score of a specific team
  • Ask Alexa who’s playing today or yesterday

Here is a demo of Skill:

While building this Skill we learned a few more valuable lessons about extending the capabilities of Alexa.

Value Mapping

There are currently 30 different NHL teams that we had to map values for. However, it turns out, there are about 150 different ways you could say the names of these teams. To make the skill as natural as possible to use, we wanted to allow users to say team or city names along with their most popular nicknames.

To handle all these possibilities we had to configure two maps. The first one maps all 150 possible free voice values to their respective three letter team code that displays on the board. For example, ‘Montreal’, ‘Canadiens’, ‘Habs’ and ‘Montreal Canadiens’ would all map to “MTL”. Then the logic of the board can use the unique code name for each team.

The second map is used when Alexa needs to speak back the name of the team. Whenever the skill needs to say the name of the “MTL” team, we convert it to the team’s full name, “Montreal Canadiens”, using the map.

Fuzzy Team Names

We had to create an extension of those maps to handle cities with multiple teams like New York. If a user asked to see the score of the New York game, they could be referring to the Rangers or the Islanders.

Fortunately, in this case, the voice to code map can resolve to multiple values. When a user asks for New York, Alexa can ask the user to clarify their choice. Alexa will respond:

“Do you mean the Islanders or Rangers?”

We expect that this pattern will be reused for several cases in future skills.

Different Voice and Text Spellings

Going back to having the user be able to ask for a team by a nickname, we realized some of these are not English words. At least not by any dictionary definition. Using our Montreal Canadiens example, “Habs” is not an English word.

One team that we had trouble with was the Colorado Avalanche. Their nickname, the “Avs” sounds extremely close to “Habs.” Alexa had some trouble with this, even in a noise free room with a native English speaker. We got Alexa to understand that we mean the Avalanche by changing the spelling from “Avs” to “Aves”. This shows that in domain-specific cases, the Alexa sample utterances need to use different spellings to make the recognition work.

The detection of “Canadiens” was also not as reliable as it could have been. In that case, what helped was to add “Canadians” as one of the Slot values. Surprisingly, Alexa always sends “Canadiens” as the spelling.

Context Specific Intents

With this skill, the user can say the team name in the context of setting their favorite team, or to temporarily show the game of a specific team.

The default behavior when a user only says the team name is to temporarily show a game.

However, when the user says:

“Alexa, ask Fantasy Scoreboard to change my favorite team.”

Alexa answers:

“Which favorite team would you like?”

In that context, saying just a team name like “Montreal” will update the favorite team. To make these fuzzy entry points context aware, we are using the session.attributes functionality of the Skill Kit. This allows a Skill to add its own value to the session, and Alexa sends it back in the follow-up request. This makes it a lot easier for Skill developers to keep track of the context set by previous requests, instead of having to use their own session stores as Redis.

Giving Alexa a Hand

Although the fixed grammar based voice recognition of Alexa helps, sometimes it will send us values that are not in our custom Slot definitions. While handling hexadecimal numbers, we had to add special handling for some misheard values.

For example, converting:

  • Tree to 3
  • For to 4
  • The to D

We expected the Slot value mapping to handle those for us, but with a bit of user testing, and good logging, catching these cases are easy enough.

Maximum Command Length

Our first skill allowed users to enter a 10 digit phone number, and it works pretty reliably. With this Skill, we need a user to enter a 16 digit hexadecimal unique ID to pair their scoreboard. After a while, we got this working pretty reliable so we decided that we could keep the interface completely voice for this Skill as well.

However, we realized that the UID for iOS users was 32 digits. When testing this we hit a limitation of Alexa that we had not realized before. It turns out that Alexa stops listening after 12 seconds.

In our SMS Skill, when that happens it matches our free form text message Intent and sends the 12-second message. With the Fantasy Scoreboard skill, we have 16 and 32 digit intents. If the users say anything between 16 and 32 digits then no intent is matched at all and Alexa quits without saying anything. This is a problem.

Obviously, it would take a lot of practice for a user to say a 32 digit hexadecimal number in 12 seconds, so in order to make the Skill more user-friendly, we extended it to allow iOS users to say the 32 digit UID in two 16 digit chunks.

What’s Next?

With our first two skills submitted, what we have left to explore is the Account Linking functionality. We will integrate that in one of our IoT concepts. The Skill will allow us to link with the account of the user to make pairing easier. Then we can query the status of the device and control it.

six oversights IoT product

Six Oversights to Consider Before Building an IoT Product

In this white paper, we outline six oversights that organizations face when entering the realm of IoT.

Download Now


Author Overview

Martin Larochelle

Martin Larochelle has been with Macadamian since 2005. In his ten years with the company, he has tackled projects both big and small as Chief Architect. An expert in C++ and VOIP, his focus has been on mobile platforms. Martin was instrumental for all things BlackBerry providing technical leadership and project oversight. Martin now leads the Macadamian Innovation Lab, a team focused on developing concepts to solve the needs of small and medium businesses and key verticals such as healthcare. While we're all a little nuts at Macadamian, Martin counts himself as the biggest HeadBlade fan in Canada.