30% off every book in our site-wide sale. Shop the sale

Intent, Entities, and Context: How Machines Follow a Conversation

Intent, Entities, and Context: How Machines Follow a Conversation

TL;DR: You will be able to extract intent and entities from any utterance, track context across turns, and judge a dialogue system by how it manages flow, correction, and task completion.

This article is one Wisdom Nugget from What Is Natural Language Processing? by Trevor Stephenson.

Imagine you walk up to a hotel reception desk and say, ‘Hi, I am here to check in, reservation under Smith for tonight.’ In that one sentence, you have conveyed several things without even thinking about it. The receptionist instantly understands your overall purpose: You want to check in. That is your intent. The receptionist also picks out the specific details needed to act: The name is Smith, the date is tonight. Those details are entities, the pieces of information that fill in the blanks for the intent. Intent and entities are the twin foundations of how machines understand what you actually mean, not just what words you used.

By the end of this Nugget you will be able to define intent and entities with the book’s examples, track context through a three-turn restaurant dialogue including corrections, and explain dialogue management, response generation, error handling, and task completion tracking in a multi-turn system.

The core idea

Intent and entities are the core of understanding single utterances. But real conversations are not single utterances. They are back-and-forth exchanges where meaning builds over time. Context is what turns a series of isolated questions and answers into a true conversation. It is also what makes dialogue systems feel intelligent and helpful, rather than frustrating and forgetful. A conversation is not just a series of independent questions. It is a collaborative process where both participants build shared understanding, track what has been agreed, handle complications, and work towards a goal. Multi-turn dialogue systems try to mimic that collaborative process. When you interact with a good conversational assistant, notice how it handles the flow: does it remember what you said, does it offer helpful alternatives when your request cannot be met, does it confirm before taking important actions, does it handle corrections gracefully, does it know when the conversation is complete? Those are signs of good dialogue management, not just good language generation.

How it works

Section 1 (Figure 7.1) defines intent and entities, classification versus sequence labelling, rules versus learning from examples, and the ambiguity challenge (‘Book a table’ versus ‘I love this book about tables’) and novel phrasing (‘Can you squeeze us in for two around seven-ish at L’Artusi?’). Section 2 (Figure 7.2) covers context tracking: dialogue state tracking, anaphora resolution, implicit information, corrections, long-distance dependencies, common ground, explicit state tables versus implicit LLM context windows versus hybrids. Section 3 (Figure 7.3) covers multi-turn dialogue architecture: NLU, Dialogue Manager, Knowledge base, Response Generation, error repair loops, the L’Artusi booking with complications (full at 7pm, dietary restrictions, parking, email confirmation), rule-based versus learned dialogue management, template versus language-model response generation, clarification strategies, and task completion tracking.

The tools

Tool 1: Extract intent and entities. An intent is the overall goal or purpose behind an utterance. It answers the question: What does the user want to accomplish? In a restaurant setting, intents might be book_table, cancel_reservation, ask_menu, ask_hours, give_feedback. In a customer support setting, intents might be report_problem, request_refund, check_status, ask_question. The same intent can be expressed in many different ways. All of these share the intent book_table: ‘Book a table for two at 7pm’, ‘Can I get a reservation for two tonight at seven?’, ‘Need a table for 2 at L’Artusi this evening’, ‘I would like to reserve a table for me and my partner for 7’. An entity is a specific piece of information relevant to the intent. If intent is the verb, what you want to do, entities are the nouns and details, who, what, when, where, how many. In ‘Book a table for two at 7pm tonight at L’Artusi’, the entities are: party size two, time 7pm, date tonight (which needs to be resolved to an actual date), restaurant name L’Artusi. Common entity types include person names, locations, organisations, dates, times, numbers, currencies. Why separate them?

Step by step

The end-of-chapter exercise as a numbered protocol, in order.

  1. Intent-entity extraction: for My flight BA249 tomorrow is delayed, can I get rebooked? list intent and entities including flight number and date.
  2. Context tracking: dialogue Is there Italian near me? / Yes L’Artusi 0.3 miles / Is it open tonight? / Book table for two at 7, track what it refers to and what implicit info must be filled.
  3. Correction handling: user says Book for two at 7… actually make it 8 and three people, describe how dialogue state should update time and party size.
  4. Failure analysis: bot keeps asking Which restaurant? after you already said L’Artusi, which component failed: intent, entity, context tracking, or dialogue management? No time is stated in the book for this exercise.

Worked example

The book’s worked example is the three-turn restaurant dialogue plus the complicated booking: ‘Book a table for two at L’Artusi tonight at 7pm’ gets ‘L’Artusi is fully booked at 7pm, but they have availability at 6:30pm or 8:30pm. Which would you prefer?’ The user asks about 8:30 and parking; the system answers that there is a car park 0.2 miles away and street parking after 6pm, and asks whether to book the 8:30 table for two. The user confirms and adds a vegetarian menu and confirmation to [email protected]. The system confirms: ‘Booked! Table for two at L’Artusi tonight at 8:30pm. I have noted vegetarian preference and sent confirmation to [email protected].

A real example from the book

Case Study – Chapter 7: Hotel Concord: Intent, Entities, and Context Across Turns. No person age is given. Hotel Concord’s front desk bot handles check-in. Guest says: Hi, I am here to check in, reservation under Smith for tonight. Bot extracts intent check_in, entities name Smith, date tonight resolved to today. Next guest says: Is it open tonight? referring to rooftop bar. Early bot lost context and asked Which restaurant? After Chapter 7, the team implements dialogue state tracking table with slots: Guest_name, reservation_date, discussed_facility rooftop bar, intent history. They add coreference resolution: It resolves to rooftop bar from previous turn, tonight to date. Guest then says: Book a table for two at 7… actually make it 8, and make it three people.

Mistakes to avoid

  • Treating each utterance as independent. Correction: conversations build meaning over turns, and context must be tracked.
  • Asking for information the user already gave. Correction: that is a dialogue state tracking failure, not a knowledge failure.
  • Adding instead of overwriting on correction. Correction: ‘actually make it 8, and make it three people’ must update time and party size, not add.
  • Taking ‘squeeze us in for two around seven-ish’ literally. Correction: good systems learn to handle informal phrasing and vague times from diverse real-world examples.
  • Generating a natural-sounding response that invents facts. Correction: ground generation in actual data and state, or the system hallucinates availability or parking.

What not to do

  • Do NOT treat utterances as independent.
  • Do NOT ask for information already given.
  • Do NOT add on correction instead of overwriting.
  • Do NOT generate responses that invent availability or details.
  • Do NOT judge a dialogue system on fluency alone.
  • Do NOT assume an LLM that handles everything implicitly is precise or remembers beyond its context window.

Low-energy mode

Take one message you sent today and name its intent and its entities in one line. That counts.

If you freelance

This is one way to apply the idea, not a passage from the book. A freelancer can use intent and entities to triage client messages: label each message’s intent and extract its entities, so a message that says ‘My flight BA249 tomorrow is delayed, can I get rebooked?’ is answered from its structured purpose plus details, not from a skim of the words.

How to know it worked

You listed intent and entities for My flight BA249 tomorrow is delayed, can I get rebooked? including flight number and date. You tracked what ‘it’ refers to and what implicit info must be filled in the L’Artusi dialogue. You described how dialogue state updates time and party size on correction. You named which component failed when the bot kept asking Which restaurant?

Key takeaways

  • Intent and entities are the twin foundations of how machines understand what you actually mean, not just what words you used.
  • Context is what turns a series of isolated questions and answers into a true conversation.
  • A conversation is not just a series of independent questions. It is a collaborative process where both participants build shared understanding.
  • If it forgets context, it would have to ask ‘Which restaurant? What date?’ again, which feels frustrating and unintelligent.

Try it today

Do Exercise – Chapter 7: Intent, Context, Conversation today (no time stated in the book, see Exercise).

End of Chapter Exercise – Chapter 7: Intent, Context, Conversation. No time stated in the book.

  1. Intent-entity extraction: for My flight BA249 tomorrow is delayed, can I get rebooked? list intent and entities including flight number and date.
  2. Context tracking: dialogue Is there Italian near me? / Yes L’Artusi 0.3 miles / Is it open tonight? / Book table for two at 7, track what it refers to and what implicit info must be filled.
  3. Correction handling: user says Book for two at 7… actually make it 8 and three people, describe how dialogue state should update time and party size.
  4. Failure analysis: bot keeps asking Which restaurant? after you already said L’Artusi, which component failed: intent, entity, context tracking, or dialogue management?

Frequently asked questions

Why does trying harder not work here?
Trying harder to answer single questions better fails here, because the chapter’s own point is that real conversations are not single utterances. A system that answers one question well but asks ‘Which restaurant?’ after you already said L’Artusi has failed at context tracking, not at knowledge. The fix is dialogue state, not a bigger answer database.

How do I know it worked?
You listed intent and entities for My flight BA249 tomorrow is delayed, can I get rebooked? including flight number and date. You tracked what ‘it’ refers to and what implicit info must be filled in the L’Artusi dialogue. You described how dialogue state updates time and party size on correction.

What if it does not work?
If the bot asks for information already given, then dialogue state tracking broke, not knowledge. If it misinterprets ‘it’, then reference resolution failed. If it cannot handle ‘actually make it 8’, then its update logic is weak. If it asks ‘Which restaurant?’ after L’Artusi was named, then check context tracking before intent or entity extraction.

Get the book

Google Play eBookGoogle Play AudiobookBarnes & Noble

More from What Is Natural Language Processing?