On day 13 of our 30-day skill challenge we will be building a simple dictionary skill to look up the meaning of any word.
Have you ever come across a word and not know what it means? Today we are going to teach Chatterbox how to look up word definitions for you so you can be a real life lexicon master.
When in the Skill Builder, if you look under the "Internet" category, you'll find a block named Get Meaning for. This block does exactly what it says. It can either get the meaning of a word, it's synonyms or it's antonyms.
The same way we start all skills, let's brainstorm how we or other people might ask questions about word meanings. You might say "define [word]" or "What's the meaning of [word]" or "what's the definition of [word]".
Since we'll be listening for multiple phrases, we'll use the Listen to Phrases block. Keep in mind that we are listening for a specific word, so we'll also need to create a "word" variable.
Next, we'll be feeding the "word" variable to the Get meaning block to fetch the definition. Any time that we use an API block, we need to store the returned information in a variable. Since we are fetching the definition, we can store it in a variable that we will create called "definition."
Last step is to speak the definition back to the user. For this you need to feed the "definition" variable to the Speak block as we've done in previous skills.
Your final skill should look something like this:
The Get Meaning block has additional functionality for synonyms and antonyms. This additional functionality will mimic the behavior of the Definition skill with a few language tweaks. Can you extend this skill to include Synonyms and Antonyms?
On day 12 of our 30-day skill challenge, we'll be learning about Date / Time objects and how we use them to teach Chatterbox to how to tell time around the world.
So far we've learned how to get weather based on your location or find answers to complicated questions. But what if we wanted answers to simple questions like "What's the date?" or "What time is it in Paris?"
Did you know that every computer has an internal clock that keeps track of time? The problem is that the internal clock of most computers use a special date/time format that makes it hard for people to read and use. But if you understand some basics about Date/Time, making skills using date and time is very easy.
What exactly is a Date/Time object? For computers, knowing the exact date and time in a human-readable format isn't necessary. But if you were to ask Chatterbox what the time was it wouldn't help if it responded with "1586760036."
That's because the computers store information in ways that make it easy to work with, but all this changes when you are talking to a computer like Chatterbox and need to respond to commands.
You can use the Get current Date Time blocks to get the current date time, but what if you want Chatterbox to Speak it? In order to accomplish this, we've created a handful of special blocks to translate Date / Time from computer speak to a human readable format.
The Pronounce Time and Pronounce Date blocks are special blocks that translate date/time objects (in this case the Get current date time block) into a format that we can understand.
Now that we've covered the basics, let's build a date and time skill that will give us the time for any location in the world.
Quick review: We use the When I hear block whenever we have an exact match for how we would like to invoke a skill. We use the On Phrases block whenever we want multiple ways of invoking (or activating) a skill.
When asking about time, you might say: "What time is it?" or "What's the time?" So we'll be using the On Phrases block. Try to think of all the ways that people will ask for the time.
Next, you are going to use the Speak block with a Pronounce Time block that will translate the Current Data Time block data into a format that we'll understand.
To get the time in a "location," we'll make a similar skill to the time skill above, but will need to create a "location" variable. We'll also need to use the Get Current Date/Time in [location] instead of the regular block.
The Date skill follows the same pattern as the time skill, except that you use the Pronounce Date block to extract and speak the date.
Your final skill should look something similar to this:
On day 11 of our 30-day skill challenge, we'll be teaching Chatterbox how to search Duck Duck Go for extended answers regarding topics. Learn about the Spanish Inquisition or learn about the American Revolution.
We've previously taught Chatterbox how to answer specific questions about the height of the Empire State Building or the depth of the Pacific Ocean. But what if we wanted to learn more about a certain topic? One of the toughest parts of skill design is understanding where to go for answers that you need.
In the case of needing an "extended answer" to a general topic or subject, we've built blocks to make it incredibly simple to search the internet using the Duck Duck Go search engine. Think of Duck Duck Go as a search engine, sort of like Google, but focused on privacy. This means that Duck Duck Go isn't collecting information about everything that you are interested in as well as everything that you are searching for. Yes, that is what search engines do! We'll be having an upcoming blog post on the importance of privacy.
Let's talk about intents. If you wanted to know what the weather was, you may go to DarkSky to get the latest weather. But what if you wanted to listen to a song? You wouldn't go to DarkSky for that, right?!
The toughest part about creating "skills" for Chatterbox is understanding where to go for information or answers. For this skill, let's use the Easter Bunny as an example. What if you wanted an extended answer or synopsis about the Easter Bunny? Well, we made a block for that!
This block will give you a short answer about lots of different topics that you might have questions about.
In the same we that we start most skills, we need to think about how we might "invoke" or activate the skill. For this example, we'll be using:
"Search duckduckgo for" [subject]
We'll need a variable to store the subject that we are searching for, so your skill may look similar to this.
The next step is to search for the subject using the Duckduckgo block to get an answer.
Something to keep in mind is that every API works in different ways. We've done our best to simplify this for you, but we want to make sure that you understand the subtleties of APIs.
When requesting an answer from the Duckduckgo block, there are things that it knows, but there are also things that it doesn't know. If Duckduckgo doesn't have an answer to a query (fancy word for question), then it might respond with the value "None."
Why this is important for us is that if there is an answer to our question, we want to speak it. But what we don't' get an answer to our question?
For this we will use a new block called an IF block, that lets us do one thing if an answer is found, and something else if no answer.
Your final skill should look similar to this:
You should have two variables: a subject variable and an answer variable. After invoking the skill, you should set the answer variable to the result of the duck duck answer block.
If there is an answer, speak it, else have Chatterbox speak "I'm sorry I don't know about that."
On day 10 of our 30-day skill challenge, we'll be teaching Chatterbox how to get answers to life's toughest questions. We'll be able to find out the distance to the moon, calculate the number of days until Thanksgiving and get the answer to what is the meaning of life.
Today we are going to learn how to teach Chatterbox how to find answers to some of our toughest questions. So far we've learned how to make Chatterbox respond to commands and get information. But what happens if we want to find an answer to a more complicated question, such as "What states border California?"
Before we go any further let's talk about questions. Before we start building a skill, it's important to understand the question being asked.
What states border California?
As humans, we are able to process most questions easily, but it's often harder to get computers to answer the same questions. In the example above, we are essentially asking 4 different questions:
What state is North of California? Oregon
What state is West of California? None
What state is South of California? None
What state or states are East of California? Nevada and Arizona
Even people might need a map for reference. It's simple to make a skill that listens for "What states border California?" But what if we wanted to change it to: "What states border Iowa?" How would we get this information without having to manually check each time, or even one time. How do we get computers do this? That's a much tougher question.
As a skill designer, your thought process should be:
Most of the time, the hardest part of this process has to do with how to find an answer to their question. This is where an amazing company and Chatterbox Partner comes in.
Meet Wolfram Alpha. According to its website,
WolframAlpha is a computational knowledge engine or answer engine.
In other words, WolframAlpha has lots and lots of different information that can be mixed, matched and computed with each using WolframAlpha technology. What does this mean for us? It means that we can simply ask it all sorts of questions in plain speech and get exactly the answer that we were looking for. It's AMAZING!
Let's build the skill and try it out!
First, make sure you have the Internet extension enabled from the Extensions page.
Next, we need to figure out people will invoke (invoke means trigger or activate) the skill. For this skill, we'll keep it simple and use "Ask wolfram alpha"
We'll be asking Wolfram Alpha all sorts of questions, so it's good practice to store these questions in a variable. Add the "question" variable to the When I hear block.
Finally, we want to search the Internet category for the Wolfram Alpha Short Answer block. This block uses the Wolfram Alpha API to search for answers and calculations from the entire Wolfram Alpha service. What's great is that it returns an answer that Chatterbox can speak.
Congratulations! You've just built a voice skill that integrates with the Wolfram Alpha API. Your final skill will look similar to this:
Special note: If you ask a question and Chatterbox responds with "Wolfram Alpha did not understand your input," it's because your question might have gotten cut off a little bit. To fix this, you can try speaking a little bit faster or you can shorten "Ask wolfram alpha" to "Ask wolfram" or whatever else you would like.
You've just turned your Chatterbox into a mini-supercomputer that not too long ago, would've been nearly impossible to create. Below are some questions to get you going:
What is the distance to the Moon?
How deep is the Pacific Ocean?
How many days until Thanksgiving?
What is the meaning of life?
What are words that rhyme with banana?
What states border California?
Where in the world is Carmen Sandiego?
How much wood could a woodchuck chuck?
What is 45 times 67?
We hope you enjoy your supercharged Chatterbox!
On day 9 of our 30-day skill challenge, we'll be making a hand wash timer that you can groove to. We'll also be learning about Skill Design and how to make Chatterbox Stop Audio and Wait.
I think it is safe to say that we all have been washing our hands more than ever before in the history of humankind. The CDC (Center for Disease Control) recommends that you scrub your hands for 20 seconds or "Hum the "Happy Birthday" song from beginning to end twice."
I don't know about you, but I'm so tired of singing Happy Birthday that I don't even want to hear it on my birthday?!
That's why today we're going to make a hand wash timer that we can groove to...
So far we've built a bunch of skills, but we haven't discuss the process of designing a skill.
There are 3 main parts to every skill:
For our hand wash timer, it should follow something similar to:
For the most part this is right. But if we think about it deeper, step #2 could involve multiple steps. Let's try this out in 3 steps.
Just like we've done in previous skills, we are going to start with a Listen block. So far, we've used two different Listen blocks.
The When I hear block is listening for specific keywords or keyphrases to match, while the On phrases like block requires similar examples in order to "train" itself to understand the variances between.
For this skill we'll simply use: "Start hand wash timer"
When we say "Play a song for 20 seconds" are we doing one thing or are we doing multiple things? Turns out that language is a little bit tricky sometimes. Humans are able to understand multiple things all at once while computers need to be told all the steps. But if we look closer we'll see that there are extra steps.
"Play a song for 20 seconds" really means:
Step 1: Luckily, we already know that the Play audio block is how we can easily play audio sounds. For this example we'll be using this song:
For this example:https://www.youtube.com/watch?v=_NNYI8VbFyY
Step 2: To make Chatterbox wait, you use the Wait block which you can find in the Actions category. This block will wait for an amount of seconds.
Step 3: We've learned how to start audio by playing it, but to Stop audio we need a different audio block. Use the audio block with a selector. Set the selector to STOP.
After 20 seconds of music, we want Chatterbox to speak. For this we use the Speak block and enter what you want the message to be.
Deploy the skill and try it out! If you didn't listen to the song yet, you're in for a nice surprise. 😀
On day 8 of our 30-day skill challenge, we'll be learning to control smart lights with magic spells from Harry Potter. This is a great skill for all the Potterheads out there to understand how Chatterbox "listens" to speech.
We know that many of you are huge Potterheads (aka Harry Potter fans). So we thought we'd get into creating magic spells to turn on and control smart lights.
So far, we've been making skills that make Chatterbox do things or communicate with different sources of information. But to make Chatterbox control lights, you need additional hardware called "smart plugs" or "smart lightbulbs" that Chatterbox can communicate with.
The current smart plugs and lightbulbs that Chatterbox can communicate are made by TP-Link Kasa. In case you don't currently have these smart plugs, Amazon currently has a sale for 17% off a two-pack.
We love smart plugs because they can be used to control lights, appliances or anything with a power on/off switch. The rest of this tutorial will assume that you have set up and named your smart plugs.
Before we can begin building the skill, we need to first enable the Smart Light Extension to give us access to the Smart Light blocks.
Once the extension is enabled, you'll have access to all the Smart Light blocks. In this skill we are going to focus on two blocks: Turn on TP Link Smart Plug and Find TP Link Device with Name.
The Turn on TP LInk Smart Plug block allows Chatterbox to send a signal to turn on or turn off any smart plug while the Find TP Link Device block, makes it easy to determine which plug you want to turn on/off.
If you're a "Potterhead," you know that the magic spell that Harry Potter used to light up his wand was "Lumos." To turn off the light, the spell was "Nox." We are going to teach Chatterbox how to respond to these spells.
For the purposes of this tutorial, when Chatterbox hears "Lumos," we want Chatterbox to respond and turn on the smart plug connected light.
Unlike other smart speakers, Chatterbox only listens when you push the big yellow button. When you push the button, Chatterbox starts listening and translates what it hears into text. If the text matches one of Chatterbox's commands, then it will speak or do whatever the skill says. If it doesn't match, then Chatterbox will respond with "I do not know how to answer that, please teach me."
What does this mean for making skills? Well, it means that while we try to guess how people will talk to Chatterbox, we also have to make sure that we test skills to ensure that Chatterbox will understand.
Turning ON lights with Lumos
Turning on lights using the magic spell "Lumos" is easy. Simply add it to the Listen block as pictured below. By deploying the skill and testing it, we can see that Chatterbox understands "Lumos" without a problem.
Turning OFF lights with Nox
Now that we can turn lights on, let's copy the same code to turn lights off. Make sure to change the keyword to "nox," the response to "Ok, turning off lights" and change the smart plug block to off.
Deploy the skill and try turning off the light. Did it work? NOPE! The reason is that when we say "nox," Chatterbox hears "knox." They sound the same but they aren't a match and therefore Chatterbox responds with the unknown message.
In this scenario, this isn't much of a problem because we can simply add additional examples to the listen block to make it trigger. This was an easy fix but in the future we'll be getting into trickier situations to make Chatterbox understand human speech.
While magic spells are wonderful for turning lights on and off, not everyone knows all the spells, so it's always a good idea to use regular examples so anyone in your house can control lights with your Chatterbox.
Let's us know what spells and skills that you come up with!
On day 7 of our 30-day skill challenge, we'll be tracking the recovery from the COVID-19 pandemic using the latest numbers from Johns Hopkins University.
It's hard to avoid all the news surrounding the pandemic that we are currently in. So we thought that we'd use this as a learning opportunity with a positive spin. Today we are going to learn how use a new API that grabs data from Johns Hopkins University to track COVID-19 recoveries in your country.
Let's review Variables from yesterday. If you recall, a variable is an object that "remembers" or stores information. You can create them by going to the Variables menu and clicking 'Create variable'.
Once you create your own variable, you can set the value of the variable or you can use the variable in a Speak block.
For this COVID-19 Recovery Tracker skill, we are going to need a variable to store the number of new recoveries per day.
Next, we need to decide how we would like to ask Chatterbox for recoveries. We'll be using the Listen block On phrases like this but need to think of all the ways that people might ask Chatterbox for this information.
We've come up with some examples, but your skill might look a little bit different.
The COVID-19 block uses an API that gathers information from Johns Hopkins University. Whoa?! What?! What's an API???
I'm glad you asked! An API stands for "Application Programming Interface" which is a fancy way of saying that it is a program that you can request information from.
To access the COVID-19 block, you first need to enable the Web APIs Extension from the extension page.
The COVID-19 block allows you to get a number for "New recoveries" by country. But just like yesterday, we need to store this number in a variable in order to be able to use it later.
Your skill should now look similar to this.
We now have set how to trigger the skill with the Listen block and have set the newRecoveries variable, it's time to make Chatterbox answer the question.
We'll do this using a Speak block and double-sided text block. If you recall you can find the text block in the "Data" category and it's handy when you want to use a variable block in a response.
We'll make Chatterbox answer the question by saying:
"Today there have been [newRecoveries] new recoveries from COVID-19 in the United States."
Your final skill should look similar to this: