Back
beginner

Foundations

What does it take for a computer to work with language?

Explore how context changes meaning, turn a language problem into a task, and test a simple rule against its failures.

Lesson 1 of 31About 18 min with practice

Read these two messages: “The workshop was brilliant” and “Brilliant, the workshop link is broken again.” Would you put both in a folder called positive feedback? The word is the same. What the writer is doing with it is different.

Before you begin: No programming or mathematics is required.

Start with the job, not the model

Natural language processing, usually shortened to NLP, is the study and engineering of systems that work with human language. A system might sort messages, find a date in a document, translate a sentence, or produce a reply. These jobs have different definitions of success. A fluent reply is not evidence that the system extracted the right date.

Imagine that you help organize a community workshop. Your inbox contains questions about registration, requests for refunds, and comments about the venue. Sorting those messages is a classification task: assigning an input to one or more categories. Pulling out a registration number is information extraction. Writing a shorter version of the comments is summarization. You can use the same inbox for all three tasks, but you need a different test for each.

This distinction will matter throughout the course. Before choosing an AI tool, finish the sentence: “Given this input, the system should produce this output, and I can check it by doing this.”

Try a rule and find its boundary

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.

MessageWhat 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.

Context resolves some ambiguity

“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.

Compare approaches fairly

A rule-based system follows instructions written by a programmer. A machine-learning system learns patterns from examples. A large language model is one kind of learned model that can support many language tasks. It does not replace the whole field, and it is not always the cheapest or most reliable option.

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.

Investigate one more 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.

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.

Continue to the next lesson.

Practice for this lesson

Route three inbox messages without a keyword rule

Turn a vague language problem into a task with a checkable output.

About 8 min40 points3 checks and one written task
Loading your lesson progress...