Tutorial: “Hey Chatterbox, what’s the weather?”

This is the lede paragraph for the blog post. It should be populated with dynamic data from a WYSIWYG custom field assigned to your posts.

Written by

Kevin Elgan

Published on

BlogUncategorized

On this skill challenge, we’ll be teaching Chatterbox how to understand all the ways people ask for weather, then look up the latest weather information from the internet.

Before we get started, let’s think about how we say things. If you were to ask a friend about the weather, how would you say it? (Try to think of as many examples as possible)

“What’s the weather today?”
“What’s the weather?”
“What’s the weather like?”
“How’s the weather?”
“What’s the weather like today?”
“Tell me about the weather?”

Using the When I hear block it might look like this…

While this might work, the repetition is bad design and can lead to problems

While this would work just fine, there would be a lot of duplicate blocks that could lead to issues after teaching your Chatterbox lots of skills. While there are multiple utterances, each utterance is asking the same question: What’s the weather for my location? This leads us to the idea of Intent. Intent is what your utterance is asking Chatterbox to do, also known as intention.

To solve this problem, we’re going to use a new block in the Listen category. This new block named On phrases like this, works similar to the When I hear block but with special powers. This block can listen for specific matches, but it can also listen for variations on phrases using a fancy term called machine learning.

Simplify multiple utterances with the same intent into a single block

Now that we understand intent (get the weather), there are other subtle questions that we need to ask. Where do we want to find the weather for? Do we want the weather right now or later? Each of these will require a different information that we will get from special weather blocks.

In order to get weather information we need to enable the ‘Weather’ extension by clicking the Extensions link then clicking the toggle for the Weather extension. Once enabled, you’ll find a new category in your skill builder for Weather.

Weather blocks that we’ll be using in this skill

Using these blocks will make Chatterbox speak a full sentence with whatever information is most relevant for the current weather, hourly forecast, weekly forecast or current weather in a location.


Skill Challenge: Make a weather skill that tells you the weather

Additional requirements:

–Speak the current weather
–Speak the daily forecast
–Speak the forecast for the week
–Speak the current weather for any city

Related Posts