SHOP NOW
0

Shopping Cart

No products in the cart.

SHOP NOW
0

Shopping Cart

No products in the cart.

Kevin Elgan
April 11, 2020

Day 11: Search DuckDuckGo for Extended Answers

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.

DuckDuckGo is a privacy-focused internet search engine.

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

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!

The Duck Duck Answer block let's you search the internet using Duck Duck Go privacy-focused search engine.

This block will give you a short answer about lots of different topics that you might have questions about.

Building the DuckDuckGo search skill

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.

"Search duckduckgo for" [subject]

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.

If there is an answer, speak the answer. If no answer, then speak "I'm sorry I don't know about that."

Putting it all together

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."

Get a 10% discount code when you sign up for our newsletter!

Chatterbox
Sign up for our newsletter to get the latest news, updates and discounts on Chatterbox.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram