DEV Community

Sajjad Heydari
Sajjad Heydari

Posted on

Slot Filling Chatbots

Assume I run a transit business. I need to know what sort of cars you need, when you need it, how heavy is your cargo, your destination and your start point.

A long time ago, I would print this as a form on paper and either hand it to you to fill, or fill it my self over a conversation on the phone. Then I would calculate the price and dispatch someone to take care of it.

A few years ago, I would convert it to some sort of a computer program, either web-based or local binary, and I would ask the user to fill it out or fill it myself over a conversation.

Now, with the current interest in social media and IMs, I could deploy my application on one of these and let the customer chat with it to put their orders. Let's see how that could go.

Scenario 1: State-based chatbot

A state-based chatbot is a simple one, at each point in the conversation, it expects something from the user. Consider the following dialog:

User: Hi!
Bot's State: conversation_start
Bot: Hi, welcome to my shop! Do you want to put an order?

User: Yes
Bot's State: order_weight
Bot: Ok, how heavy is your cargo?

User: Around 400 Kg
Bot's State: order_dest
Bot: And where is your destination?

...

You can imagine how that goes. That would work fine if the user complies with what the bot is asking. Now consider this:

User: Hi! I have 400Kg cargo that I want to deliver to X.
Bot: Hi, welcome to my shop! Do you want to put an order?

User: Ummm, yes, I have a 400kg cargo for X.
Bot: Ok, how heavy is your cargo?

Ops. That didn't go too well.

Scenario 2: Slot Filling Chatbot

A slot filling chatbot is no different from a regular state-based chatbot. Perhaps the only real difference is that it uses some form of NLU to understand what the user is saying. Say, for example, the user provides her cargo weight in the first message. The slot filling chatbot would jump over that step because it already knows the weight. So the second dialog would go smoother.

In the next posts, I'll try to write a tutorial on writing a slot filling chatbot.j

Top comments (2)

Collapse
 
mehrad77 profile image
Mehrad Rousta

You said Slot Filling Chatbots need some form of NLU. does that means State-based chatbot don't need NLU?
I mean how can we extract our needed information in the first place?

Collapse
 
mcsh profile image
Sajjad Heydari

State-based bots could use NLU, but don't have to. They could be entirely keyword based, rely on exact answers or on fixed keys, like Woebot.

When I first started programming, we used to write "menu"s that were like this, enter 1 to do foo, enter 2 to do bar. You can do that with words too, and rely on the user to input things correctly.