Book a free call

How to Build a Chatbot Using NLP: A Practical Guide

An NLP chatbot understands what a person types by matching the message to an intent and pulling out the details, then answering from replies the team controls.

Hertiv engineering teamReviewed by a senior engineer
6 min read
How to Build a Chatbot Using NLP: A Practical Guide
On this page

Short answer

A chatbot built with NLP uses natural language processing to match a message to an intent, pull out the details that matter, and answer from replies the team controls. It handles wording it has never seen, unlike a rule-based bot, and it stays within set answers, unlike a free-form language model chatbot.

What is a chatbot built with NLP?

A chatbot built with NLP is a program that uses natural language processing to understand what a person types and to answer in words. NLP breaks a message into its meaning: what the person wants, which details matter, and what the chatbot should do next. The chatbot then picks a reply from its answers or asks a short follow-up question.

It differs from a rule-based chatbot, which only follows paths a person wrote in advance. An NLP chatbot can handle wording it has never seen, because it matches the message to a learned intent instead of an exact phrase.

It also differs from a large language model chatbot, which writes free-form answers from a model; an NLP chatbot works from a set of intents and replies the team controls. For the basics, see what a chatbot is.

Pipeline stageWhat it doesExample
UnderstandReads the message and finds the intent"Where is my order?" means track order
ExtractPulls out the details that matterOrder number, date, product name
DecideChooses the next step or replyLook up the order, then answer
RespondSends a short, clear reply"Your order arrives on Thursday."
LearnLogs misses and adds new phrasesNew wording for the same intent

How does NLP understand what a user means?

NLP understands a message by matching it to an intent, which is the thing the user wants, and by pulling out entities, which are the details. An intent might be "track my order" or "change my booking", and the entities might be an order number or a date. The chatbot needs both: the intent tells it what to do, and the entities tell it which case to look up.

The model learns intents from training phrases, which are real examples of how people ask for the same thing. Ten to twenty phrases per intent is a normal starting point, and they should come from real chats, emails or call notes, not from what the team imagines people say. Phrases that look different but mean the same thing are the most valuable, because they teach the model the range of real wording.

Entities come in two kinds. Some are built in, such as dates, numbers and money. Others are specific to the business, such as product names, plan names or store locations, and the team lists them by hand. A missing entity list is a common reason a chatbot understands the intent but cannot act on it.

How do you train the NLP model?

Training starts with the list of intents and the phrases for each one. The team gathers real messages from support inboxes, chat logs and call notes, then sorts them into intents and removes duplicates. Each intent should have phrases that cover the main ways people ask, including short forms, typos and polite forms.

The team then tests the model on messages it has not seen, and checks two things: how often it picks the right intent, and how often it is confident when it is wrong. A model that is often wrong and confident is worse than one that often says it does not know, because a wrong answer sends the user down the wrong path.

Training never really ends. The team reviews the messages the chatbot missed each week, adds the good new phrases to the right intents, and retests. A chatbot whose training data stops growing will slowly get worse as customers change how they ask.

How do you build an NLP chatbot step by step?

Build in small steps, with a real test at each one, so problems show up early.

  1. Pick one job, such as answering delivery questions, and list the twenty questions it covers.
  2. Write the intents for those questions and gather ten to twenty real phrases for each one.
  3. List the entities each intent needs, such as order numbers or dates, and where the chatbot will look them up.
  4. Build the answers, keeping each one short, and add a handover to a person for anything the chatbot cannot handle.
  5. Test with fifty real messages from your inbox, fix the misses, and launch on one page only.

After launch, read the chat log every day for two weeks. The misses will show which intents need more phrases and which answers confuse people. Fix those first, before adding new jobs.

For teams that want help building the first version, AI chatbot development covers the design and the handover rules that keep the bot useful.

How do you test and improve an NLP chatbot?

Test with real messages, not the phrases the team wrote. Take fifty to a hundred messages from the inbox or the support log and type them in exactly as customers wrote them, typos included. If the chatbot answers most of them well, it is ready for a small launch. Also test the edges: a message with no clear intent, a rude message, and a visitor who types only "help".

Track three numbers each week: how many messages got the right intent, how many the chatbot handed to a person, and how many got a wrong answer. The wrong answers matter most, because they cost trust. A chatbot that hands over when it is unsure will annoy fewer people than one that guesses.

Improvement comes from the log, not from guessing. Each week, take the missed messages, sort them into intents, and add the best phrases. If one intent keeps failing, split it into two clearer intents instead of adding more phrases to a muddled one.

A first-chatbot guide covers the launch checklist in more depth; see how to develop your first chatbot before the bot goes live.

Example (hypothetical): a support team builds its first NLP chatbot

A support team answers 300 delivery questions a week, each taking about 4 minutes, which is 300 x 4 = 1,200 minutes, or 20 hours a week. The team builds an NLP chatbot with 12 intents for delivery questions, using phrases taken from the last three months of chat logs.

In testing, the chatbot picks the right intent for 440 of 500 test messages, which is 88%. The team adds 100 more training phrases from the misses, and the next test gets 470 of 500 right, which is 94%. The chatbot then handles 200 of the 300 weekly questions, saving 200 x 4 = 800 minutes, or about 13 hours a week.

The other 100 questions still go to a person, including the ones the chatbot is unsure about. The saving holds because the team keeps reviewing the misses each week instead of trusting the first test result.

What are the common mistakes?

Most NLP chatbots fail because the intents are muddled, the training phrases are made up, or nobody reviews the misses.

  • Writing training phrases from imagination instead of real customer messages
  • Using one intent for two different jobs, so the model cannot tell them apart
  • Forgetting the entities, so the chatbot knows the intent but cannot act
  • Letting the chatbot guess instead of handing over when it is unsure
  • Testing only with the phrases the team wrote, never with real inbox messages
  • Stopping training after launch, so the model slowly falls behind how customers ask
  • Writing long answers that visitors on a phone will not read

Key takeaways

  • NLP matches a message to an intent and pulls out the entities the reply needs.
  • Training phrases should come from real customer messages, not from imagination.
  • A chatbot that hands over when unsure beats one that guesses wrong.
  • Test with real inbox messages, and track wrong answers most closely.
  • Keep training after launch, or the model falls behind how customers ask.

Frequently asked questions

What is NLP in a chatbot?

NLP, or natural language processing, is the technology that lets a chatbot read a message and work out what the person wants. It matches the message to an intent, such as tracking an order, and pulls out entities, such as the order number. The chatbot then follows the reply or action tied to that intent.

How is an NLP chatbot different from a rule-based one?

A rule-based chatbot only follows paths a person wrote in advance, so it fails on wording it has not seen. An NLP chatbot matches the message to a learned intent, so it handles new phrasing. It still answers from replies the team controls, which keeps its answers predictable.

How is an NLP chatbot different from an LLM chatbot?

An LLM chatbot writes free-form answers from a large model, which can be flexible but hard to control. An NLP chatbot works from a set of intents and set replies, so the team knows exactly what it can say. Many teams start with NLP and add a language model later for open questions.

How many training phrases does each intent need?

Ten to twenty real phrases per intent is a normal starting point. The phrases should cover the main ways people ask, including short forms and typos, and they should come from real chats or emails. More phrases help, but only if they are real examples of the same intent.

How do you know if the chatbot is working?

Track how often it picks the right intent, how often it hands over to a person, and how often it gives a wrong answer. The wrong answers matter most, because they cost trust. Review the missed messages each week and add the best new phrases to the right intents.

When should the chatbot hand over to a person?

It should hand over whenever it is unsure of the intent, when the request involves money, complaints or personal data, or when the user asks for a person. A clear handover is better than a confident guess, because a wrong guess is harder to undo than a short wait.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: AI and agent systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Planning a chatbot that understands your customers? Talk to Hertiv.

A senior engineer replies within one business day. Or see our AI Chatbot Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call