Talking with My First Azure Bot

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@kidsysco·
0.000 HBD
Talking with My First Azure Bot
This is my first experiment with Azure Bots and Cognitive Services. I have created what Azure calls a Question and Answer Bot.

# Frequently Asked Questions

The Q & A Bot has been designed to work off of a typical F.A.Q. otherwise known as a list of Frequently Asked Questions.

Anyone on the Internet has seen a list of frequently asked questions and I bet you rarely read through these documents unless you are really stuck. Even if you do decide to read the F.A.Q., you still must read through each question sequentially to find an answer. 

Another huge problem with the F.A.Q. is how they are worded so specifically. Not everyone speaks the same way, so simple searches don't always find what you are looking for unless it is spelled and phrased exactly how the question is asked in the F.A.Q.

No one wants to go through all of this, we would much rather just ask a question and get an answer back.

# Digital Assistants

There is a lot of talk about digital assistants over the past few years. Apple Siri, Microsoft Cortana, Amazon Alexa, and Google Assistant are competing heavily for the market space right now. Even Facebook is reported to be working on a new digital assistant for the masses.

https://cdn.pixabay.com/photo/2015/01/27/20/40/office-614213_960_720.jpg

These bots are capable of actually understanding what is being asked by the human. So it usually does not matter how the question is phrased, the computer still knows what you mean.

So the idea of loading a F.A.Q. into a bot is genius and I have a feeling that everyone will soon be converting their F.A.Q. files to a bot acting as a digital assistant for the content. This feels so much better than forcing customers to read through the entirety of a F.A.Q. like some sort of... Caveman.

# My Experiment

I found a fairly random PDF of a F.A.Q. off the Internet about Industrial Helmet Safety. I uploaded the PDF file into my Bot using a simple Azure webpage.

Azure read the PDF file and compiled all of the content into a question and answer spreadsheet, that I could then tweak.

http://i.imgur.com/sop20Dw.png

The machine learns about these topics by examining both the question and the answer. The first question and answer set listed was a simple Hi for a question and Hello for an answer.

I noticed that when I said "Hi" to my bot, it responded by saying "hello" back to me.

However, when I said "Good Morning" to my bot, it could not find a good response.

```

Me: Good Morning!

{"answer":"No good match found in the KB","score":"0"}
Is there another question I can help you with?

```

So I modified the question to add a few more words that are similar, like "hello", "good day", "greetings", and "howdy". You can see these in the image above listed under Q1.

Then I simply clicked the Save and Re-train button.

http://i.imgur.com/KOUfxwX.png

This causes the Azure Machine Learning system to kick in and train my bot to talk about the data that I have supplied to it.

Now I can use any greeting I want and my bot appears to respond appropriately...

```
You have been connected to the Helmet Safety Bot. 
You can ask a Safety question about your helmet now.

Me: Hi

{"answer":"Hello, how can I help you with Helmet Safety?","score":"48.6686140596867"}

Me: Greetings

{"answer":"Hello, how can I help you with Helmet Safety?","score":"65.6694403588772"}

Me: Hi there Mr. Computer Bot.

{"answer":"Hello, how can I help you with Helmet Safety?","score":"14.3055930882692"}

Me: Howdy doody Mr Computer Bot.

{"answer":"Hello, how can I help you with Helmet Safety?","score":"9.42159057408571"}

Me: Good evening Mr Computer Bot!

{"answer":"Hello, how can I help you with Helmet Safety?","score":"8.03786706924438"}

```

You can see the score is listed with each response from the bot. This score will give an indication on just how sure the machine thinks it has the correct answer. Higher numbers are better.

# More Complicated Questions

After getting the greetings to work better, I moved on to the real content about helmet safety. Similar to above, I needed to add a few keywords to the questions, save and re-train the bot again in order to get the best responses.

With just a little bit of adjustment here is the conversation I had with my test bot about Helmet Safety...

```
Me: Can my guys wear a cubs baseball hat under their work helmet?

{"answer":"MSA does not recommend placing a baseball cap between the head and the suspension; baseball caps may interfere with the helmet suspension's  capability to work properly during impact.","score":"52.2715191394091"}

Is there another question I can help you with?

Me: Well what about like a bandana or something like that?

{"answer":"A bandana, hood, or skullcap should not affect an MSA helmet's impact properties as long as it is worn smoothly on top of the head. Caution should be taken to avoid bunching up of material, which can cause pressure points and affect the helmet's ability to protect as designed. A ratchet suspension and/or chinstrap should be used to help ensure the best possible fit.","score":"23.0468600094318"}

Is there another question I can help you with?

Me: My guys like to wear their helmets backwards because they think it looks cool, is that still safe?

{"answer":"The following MSA helmets meet the requirements for the reverse donning optional feature in ANSI/ISEA Z89.1-2014:  V-Gard Caps and Hats  Topgard Caps and Hats NOTE:When wearing a helmet in reverse, be sure to reverse the suspension so the nape strap is facing the brim. Use caution before using accessories while wearing an MSA helmet backwards.  Wearing a cap with the brim facing the rear may reduce the performance of accessories, such that they may not meet the applicable requirements.","score":"19.5188308991492"}

Is there another question I can help you with?

```

As you can see, I used some pretty wild phrasing for these questions and I tried to write like how many people speak. 

It was rather difficult to confuse the system and it picked up the correct answers for me no matter how I asked the question. I tried to throw it off by using lots of additional terms and information that did not apply but this is not just a keyword search, the computer was able to actually tell what I was asking.

# Conversation Tracking

https://cdn.pixabay.com/photo/2015/07/06/14/57/speech-833379__340.png

In more advanced bot development, there are a features for tracking conversation topics. In the example above, the user keeps saying hi in different ways to the bot. With conversation tracking, the bot could respond after the 2nd greeting by saying something like... "I have already said hi to you, why are you being annoying?" And then it could wait for an answer along some new lines of conversation.

# IDEAS!

My head has been steadily producing ideas for using these bot services all weekend. Here are just a few...

How about a question and answer bot for Steemit? it could be maintained by knowledgeable folks who could take input from the numerous articles written on the subject.

Or how about wiring up the Speech to Text Cognitive Service on Azure so that users can speak their questions into the app or website? Azure could take the audio clip, convert it to text, then submit the text to your bot to get an answer. This would allow users to speak into their phones to speak at the bot instead of typing.

Or what about storytelling and gaming? I worked with a project created by @dwinblood years ago where we were controlling large groups of digital characters in a video game to make them behave more life like. 

https://neverwintervault.org/sites/neverwintervault.org/files/project/1435/images/1212672219fullres.jpg

What if we could speak to these digital characters in-game using the Azure Bot Service behind the scenes? We could load up huge sets of conversations and allow game players to actually talk to the game characters rather than selecting speech from a menu or needing to type specific phrases to trigger an event. We could walk the character through huge sets of story arcs with elaborate systems of clues and branching conversational topics.

Do you have any other cool ideas?
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,