KwickAcademy Artificial Intelligence · 7 min · free
Chatbots, Sentiment Analysis and Emotion Detection
Script bots follow a fixed script; smart bots use AI. Sentiment analysis labels text positive, negative or neutral. Emotion detection names feelings, but its result is only a guess.
Follows the syllabus of: CBSE Class 10 Artificial Intelligence (417), CBSE Class 11 Artificial Intelligence (843), CBSE Class 12 Artificial Intelligence (843)
On screen in this lesson
What is a chatbot?
| A program that chats with people in human language |
| Works through text, voice or both |
| Found on bank, railway and shopping websites |
| One of the most common uses of NLP |
Script bot vs smart bot
| Point | Script bot | Smart bot |
|---|---|---|
| Works from | fixed script | AI and data |
| Language skill | little or none | uses NLP |
| Learning | does not learn | learns from data |
| Making it | easy, little code | needs more coding |
| Example | order-status menu | Alexa, Siri |
Pause and predict
| A bot shows buttons: Balance, Last 5 transactions |
| You type: how much money do I have? |
| It replies: Please choose an option |
| Answer: a script bot, it only follows its script |
What is sentiment analysis?
| Finds the feeling behind a piece of text |
| Positive, negative or neutral |
| Used for food, movie and product reviews |
| Helps companies read lakhs of reviews quickly |
Reviews and their sentiment
| Review | Clue words | Sentiment |
|---|---|---|
| Biryani was tasty | tasty | Positive |
| Delivery was late | late | Negative |
| Order came at 8 pm | none | Neutral |
Where word counting fails
| Not tasty contains tasty, but means bad |
| Sarcasm: Great, cold food again! |
| Hinglish: Khana ekdum mast tha |
| Smart models learn context from many examples |
Quick answers
A bot replies 'Please choose an option' to a typed question. Which type?
A script bot.
What score does the word-count program give 'not good'?
+1, though the review is negative.
KwickClips from this lesson
Short clips, one idea each. Good for revision the night before.
Does a script bot learn?43 sec
What does get() do if the key is missing?39 sec
What are the three labels?41 sec
Is an emotion AI result a fact?42 secThe full lesson, in text
Hello students, welcome to Kwickprep. You type, where is my order, and a chatbot replies in one second. You write, the food was not good, and a simple program thinks you were happy. Today we compare script bots and smart bots, build a small chatbot, analyse reviews, and see where emotion detection fails.
Let us start with the meaning. A chatbot is a computer program that talks with people in human language. It can chat through typed text, through voice, or both. You meet chatbots on bank websites, railway booking sites and shopping apps. Chatbots are one of the most common uses of Natural Language Processing, or NLP.
Chatbots come in two types, script bots and smart bots. A script bot works from a fixed script, while a smart bot uses AI and large amounts of data. A script bot understands little or no language, but a smart bot uses NLP to understand your meaning. A script bot never learns, while a smart bot improves with more data. Script bots are easy to make, but smart bots need much more coding. A menu bot that asks, press one for order status, is a script bot, while Alexa and Siri are smart bots.
Let us test yourself with a bank chatbot. The bot shows two buttons, balance and last five transactions. Instead of pressing a button, you type, how much money do I have? The bot replies, please choose an option. Pause and predict, is this a script bot or a smart bot? It is a script bot, because it cannot understand words outside its script.
Now let us build a small script bot for a coaching class. The dictionary bot stores a reply for each keyword, hi, timing and bye. We test it with three messages. Lower makes every message small, so Hi and capital TIMING still match. Get finds the reply, and if the key is missing, it gives Sorry instead. So fees, which is not in the script, gets the reply Sorry.
To chat for real, we put the bot inside a loop. While True keeps the conversation going again and again. Input waits for you to type a message. The bot prints its reply, or Sorry if the word is unknown. When you type bye, break ends the loop. This is still a script bot, because it only knows the words we wrote.
Next, sentiment analysis. Sentiment analysis is an NLP task that finds the feeling behind a piece of text. It usually sorts text into positive, negative or neutral. It is used on food delivery reviews, movie reviews and product reviews. A company cannot read lakhs of reviews by hand, so sentiment analysis gives a quick picture.
Let us sort three food delivery reviews. The biryani was tasty has a happy clue word, tasty, so it is positive. Delivery was late has an unhappy clue word, late, so it is negative. The order came at eight pm only states a fact, with no feeling, so it is neutral.
Here is a simple sentiment program that counts clue words. We keep a set of good words and a set of bad words. The review is, tasty and fresh but cold. For each word, w in good is True or False, and Python counts True as one and False as zero. So each good word adds one, and each bad word takes away one. Two good words and one bad word give a score of one, so the review is positive.
Pause and predict, what score does our program give to, the biryani was not tasty? It gives plus one, but the review is negative. Sarcasm fools it too, because great, cold food again, is a complaint. Mixed language reviews use words that are not in our lists at all. So real sentiment tools use machine learning models, trained on lakhs of labelled reviews, to understand context.
Emotion detection goes one step further than sentiment analysis. Sentiment asks, how positive or negative is this, while emotion detection asks, which feeling is it? Sentiment gives positive, negative or neutral, but emotion detection names feelings like joy, anger, sadness and fear. Sentiment mostly works on text, while emotion detection can also use voice tone and facial expressions.
Here are some uses of emotion detection. A call centre can find angry customers quickly and send them to a senior person. A wellbeing app can notice stress in messages and suggest talking to someone. Companies study how viewers react to an advertisement. Games and learning apps can adjust when a user looks bored or confused.
But emotion detection has serious limits, and exams often ask about them. A smile can hide sadness, so a face does not show everything a person feels. The way people express feelings differs across cultures and languages. A model trained mostly on one group of people can give wrong results for others. And reading faces and voices raises privacy concerns, because this is personal data.
So how should we use emotion detection responsibly? Treat its result as a guess, never as a fact about a person. Ask for permission before collecting face or voice data. Never use it alone to judge a student in an exam or a worker in a job. In fact, the European Union's AI law bans emotion recognition in schools and workplaces, except for medical or safety reasons.
Let us revise what we learned today. Script bots follow a fixed script, while smart bots use AI and learn from data. A simple chatbot matches keywords to stored replies, using a dictionary. Sentiment analysis finds if text is positive, negative or neutral, but word counting fails on not good and sarcasm. Emotion detection names feelings like joy and anger, but its result is only a guess, so use it carefully.
Courses that teach this
| Course | Unit |
|---|---|
| CBSE Class 10 Artificial Intelligence (417) | Part B Unit 6: Natural Language Processing |
| CBSE Class 11 Artificial Intelligence (843) | Leveraging Linguistics and Computer Science |
| CBSE Class 12 Artificial Intelligence (843) | Generative AI |
Voice-over in this lesson is AI-generated. The script is written and checked by Kajal Ma'am. Boards can revise a syllabus mid-year, so confirm anything you plan around against the official board circular. Keep your passwords, OTPs and ID numbers to yourself — we never ask for them. To reach Kajal Ma'am, use the WhatsApp button; sharing your number there is how we call you back.
Free to watch, no sign-up. Live classes with Kajal Ma'am are the paid course; these lessons stay free either way.

