Ask a calculator to multiply two large numbers and it follows a clear set of rules. Now ask a computer what someone means by “Great, the train is late again.” The word “great” usually sounds positive. Here, the person is probably annoyed. How would the computer work that out?
Before you begin: You can follow the explanation without programming. Any prerequisites for the optional technical walkthrough are listed there.
That question takes us into natural language processing, usually shortened to NLP. “Natural language” means the language people use, such as English, Telugu, or Spanish. “Processing” means doing something useful with it: reading a message aloud, translating a sentence, finding an answer, or helping someone write a reply.
You do not need to know how to program to understand the problem. You already have the most useful starting point: experience with how people talk.
Why language is harder than it looks
Imagine receiving this message: “Can you open the window?” The sender probably wants you to open it. Answering “Yes, I can” and leaving it closed would miss the request, even though the answer is literally correct.
Or consider the word “bank.” In “I deposited money at the bank,” it refers to a financial institution. In “We sat on the riverbank,” it refers to land beside the water. The nearby words help you choose a meaning. We call this context: the information around a word or sentence that helps us interpret it.
People also leave things unsaid. “Is it still on?” makes sense if you were just discussing tomorrow's class. Without that earlier conversation, even another person might need to ask what “it” refers to. A useful language system must sometimes ask for more information.
Where you already use NLP
A phone turning your speech into a message is working with language. So is an email service sorting spam, a translation app explaining a sign, or a search engine matching your question to a page.
These jobs have names, but the ideas are familiar. Classification means sorting something into a category, such as spam or ordinary mail. Summarization means making a shorter version while keeping the important points. Translation means expressing a message in another language.
Take a workshop inbox. “Please refund my ticket” should reach the refunds team. A simple rule could look for the word “refund.” But “I don't need a refund; I need the joining link” contains the same word and asks for something different. “Can I get my money back?” asks for a refund without using the word at all. The figure shows why spotting a word is only a starting point.
Read the request, not just the keyword
Please refund my ticket asks for money back. I don’t need a refund; I need the joining link asks for access. Can I get my money back asks for a refund without using the keyword. Highlighted phrases show what changes the meaning.
The keyword and the request agree
“Please refund my ticket.”
Return the payment. “Refund” names what the person wants.
A small phrase reverses the request
“I don’t need a refund; I need the joining link.”
Help the person join. “Don’t need” rules out a refund. The second part supplies the actual request.
The request stays; the keyword disappears
“Can I get my money back?”
Return the payment. Different words express the same request as the first message.
Walk through this example
The inbox example gives us a way to see what language processing is doing. Read a message once for the words it contains, then again for the action its writer wants. Those two readings can disagree. A useful system must turn the second reading into something concrete, such as a folder label, without pretending that every message has an obvious interpretation.
The comparison below changes only the words around “refund.” The important observation is that a word can be present while the request associated with it is absent. In the activity, keep a small “other” category for messages that do not fit the available labels. That is a deliberate output, not a failure to build a clever enough rule.
“I need a refund.” The writer asks for money back.
Insert “do not” before “need,” and add “I need the joining link.”
The word “refund” remains, but the requested action is now help with joining.
Read each message as a request. A keyword records presence; a task label represents the decision you need to make.
How do we teach a computer to do this?
One approach is to write rules. Another is to give a system many examples so it can learn patterns. Both are still useful. A rule may be enough to recognize a booking-number format; interpreting the meaning of a complaint usually needs more.
A large language model, or LLM, is one kind of system trained on language. It can help with many NLP tasks, including writing and summarizing. We will meet it properly later. For now, remember the problem that motivates the technology: people express meaning in many different ways, and a useful computer system has to deal with that variety.
Try interpreting a message
Someone writes: “The teacher was wonderful, but I could barely hear the microphone.” Would “They loved the class” be a fair summary?
Compare your answer
It leaves out the complaint. “They liked the teacher but had trouble hearing” keeps both parts. That is a small example of what we want from NLP: preserve what the person meant, including the inconvenient details.
Go further
Technical walkthrough (optional)
NLP stands for natural language processing. It is the field of computing that deals with human language: finding information in text, translating sentences, recognizing speech, or writing a reply. You have probably used it in a search box, a translation app, or an email spam filter.
How does a computer work out what a message means? Read these two: “The workshop was brilliant” and “Brilliant, the workshop link is broken again.” Would you call both positive feedback? The same word expresses praise in the first message and frustration in the second. That is one of the problems NLP tries to solve.
For this optional walkthrough: No programming or mathematics is required.
What can NLP do?
Imagine helping with a workshop inbox. Here are three different jobs you could give a language system:
| Job | Example input | Useful output |
|---|---|---|
| Classification: put a message in a category | “Can I get my money back?” | Refund request |
| Information extraction: find a specific detail | “My registration is A4417.” | A4417 |
| Summarization: shorten a message while keeping its main points | “The teacher was helpful, but I could barely hear the microphone.” | Helpful teacher; poor audio |
The input is text in each case, but the answer you need is different. To check the first job, compare the chosen category with the request. For the second, check the registration number. For the third, check that both the praise and the complaint survived. Naming the job helps you choose a method and see when it goes wrong.
Try sorting messages with a keyword
Start with a simple rule: if a message contains “refund,” send it to the refunds folder. Predict what happens to these messages before reading on.
| Message | What a person probably needs |
|---|---|
| “Please refund my registration.” | A refund |
| “I do not need a refund; I need the joining link.” | Help joining |
| “Can I get my money back?” | A refund |
The rule catches the first request. It sends the second to the wrong place because it ignores the negation. It misses the third because the writer uses different words. These failures expose two recurring language problems: the meaning of a phrase depends on its surrounding words, and different phrases can express the same intention.
Rules are still useful. An exact registration-number format may be easier to validate with a rule than with a language model. The question is whether a method fits the task, rather than whether it belongs to the newest generation of AI.
How context changes meaning
“Meet me at the bank” leaves a location unclear. “Bring your account number” makes a financial institution more plausible; “Bring your fishing rod” suggests a riverbank. Context is information that helps interpret the message. It may come from nearby words, an earlier conversation, or a document the system is allowed to use.
More context does not guarantee an answer. If two workshop sessions have the same name and the message gives no date, the responsible response may be a question. Guessing smoothly would hide the missing information.
Human readers also disagree. “The room was small but comfortable” can reasonably contain both criticism and praise. If you build a dataset, decide whether the label means overall satisfaction, complaints about space, or something else. A model cannot repair an unclear definition of the task just by seeing more examples.
Rules and machine learning
A rule-based system follows instructions written by a programmer. A machine-learning system learns patterns from examples. Both can be used for NLP. A large language model, or LLM, is one type of learned model that can perform many language tasks. NLP is the wider field; an LLM is one of the tools used within it.
For our inbox, compare a keyword rule with a learned classifier on messages neither method was tuned on. Count both missed refund requests and unrelated messages sent to the refund team. The cost of those mistakes may differ. That gives you a reason to choose a method beyond how impressive its demonstration looks.
Try labeling a message
“I loved the teacher. I could not hear half the lesson because of the microphone.” Decide what labels you would allow. Then write a one-sentence summary that preserves both points.
Compare your interpretation
An overall positive or negative label loses information here. Labels such as “teacher praise” and “audio problem” preserve the two observations. A faithful summary is: “The learner liked the teacher but had difficulty hearing the lesson.” “The learner loved the workshop” leaves out a material complaint. This is why task design comes before model selection.
You now have a language task and a way to notice failure. The next question is how a computer can learn useful patterns from examples instead of relying only on the rules you write.
More practice (optional)
Route three inbox messages without a keyword rule
You help run a community workshop. The shared inbox holds registration questions, refund requests, and venue complaints. Someone suggests a rule: if the message contains the word "refund", send it to the refunds folder.
Check your understanding
Try the task and write your answer
Your task
Write a task definition for the inbox sorter, then say how you would catch it being wrong.
Saving your notes on this device...
What to include
- The output is named concretely (a folder label, not "understand the message")
- The check is something you can run on messages the method never saw
- You count both misses and wrong routings, not just accuracy
- You say which of the two mistakes is more expensive for the workshop
Compare with a worked answer
Here is one way to answer. Check how it uses the information in the task.
Task definition Given: a message from the workshop inbox The system should produce: exactly one of the labels registration, refund, venue, or other I can check it by: hand-labelling 50 messages the method never saw, then comparing its label with mine
Two failures I expect 1. Missed refund: a refund request labelled registration, so nobody sends the money back. 2. False refund: a question about registration labelled refund, so the refund team wastes time.
Which mistake costs more, and why: A missed refund costs more. The person is already unhappy, and silence turns a routine refund into a complaint. A false refund costs a volunteer two minutes. So I would tune the sorter to catch refunds even at the price of a few extra false ones, and I would report the two counts separately instead of one accuracy number.
Your work stays on this device. After account creation, you will return to this challenge and your edited notes will carry with you.
What comes next?
Continue with What is machine learning?.
Further reading
The authors' Speech and Language Processing covers language tasks and the methods used to study them. The workshop messages in this lesson are original examples, not measured model outputs.