Check out a free preview of the full Tree and Graph Data Structures course

The "Modeling a Chatbot" Lesson is part of the full, Tree and Graph Data Structures course featured in this preview video. Here's what you'd learn in this lesson:

Bianca models a chatbot to solve the problem of deciding on breakfast each morning and plans out its desired behavior.

Preview
Close

Transcript from the "Modeling a Chatbot" Lesson

[00:00:00]
>> Bianca Gandolfo: Morning routines, so what you're supposed to do. And I do plan, I was reading my goal journals from since I was a teenager. And that's always, exercise twice a day or something stupid like that. No offense to anyone who does that. But I have these big goals.

[00:00:22]
I'll plan in the morning, I'll wake up. I'll have some fancy tea and I'll just feel great, I'll meditate in the forest, something like that. But the reality is I wait until the very last minute. I do get up and feed my cat. I wait until the very last minute, and then I roll out of bed.

[00:00:44]
My husband makes a coffee for me every morning, which is great, so I have coffee there already. And then I rush to get ready, and he has very strict meetings, so that makes me have to leave at a certain time, otherwise he's late. We commute together and we make it.

[00:01:02]
And I get to work and have a slow start and drink more coffee and catch up on some things and it's working for me. But one thing that I do have trouble with is the food part. Having to make these decisions really early in the morning is basically impossible.

[00:01:26]
So being a technologist, I was like, we can solve this. We can solve this. We can just make a chat-bot that tells us what to eat every morning. It knows us, we know them. We can be in bed and do this, easy. So let's do that. Are you guys ready?

[00:01:47]
We're gonna make a chat-bot. It's gonna help us choose breakfast in the morning. Seems simple, but there's potential here to expand, can recommend lunch, dinner. Nothing is too small. You ready? Now is the instruction part. Story time is over. So the first thing we need to do when we're creating software is think about our underlying data model.

[00:02:18]
How are we gonna implement our chat-bot with questions and answers? How's that gonna work? So I dig deep into my data structures and algorithm knowledge. And I'm like, we'll use an object. Why not, it's easy. We'll just use an object. Why make it complicated? Never over optimize. Let's start, we'll make an object.

[00:02:43]
This object will have the question. The first question is, do you feel like cooking? Answer is always no. But we have options for those of you who are into the cooking thing in the morning. I don't know, maybe it's a day off or something and you make a nice breakfast on a holiday.

[00:03:01]
So then we have our next steps, we have the yes and the no. And then maybe that will ask more questions. So, we have the same structure where we have this branching logic. So, do you feel like cooking? Yes. Okay next. Maybe do you have toast, yes or no?

[00:03:25]
Etc., until we reach a point where we are able to make a recommendation. Everyone following here? Here's the code, here is the picture. In these data structures classes, we always draw circles, we put some numbers in it or some words and we connect them with lines. I think it's really important to think about it like that.

[00:03:49]
But it's also just as important to be able to look at this diagram and have some sense of how that might look with code. So that's why I like to have both of these. If at some point, you're seeing a diagram and your mind isn't really clicking with this code might look like, ask me.

[00:04:08]
That's super, super important because we aren't diagram drawers. We're software engineers, we're programmers, we need to actually code this stuff out.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now