Ever wondered how chatbots process messages and answer questions? Automated chat relies on natural language processing to do this. We’ve covered what natural language processing is and how NLP works in some of our other blog posts. But we wanted to take a deeper dive into some of the more complex concepts to get a deeper understanding of what goes on behind the scenes.
ZyraTalk software engineer intern Sagar Shah is joining us on the blog to answer some of the most common questions about natural language processing and machine learning in automated chat. Over to you, Sagar!
1. What's the difference between machine learning and natural language processing?
The five human senses are sight, hearing, smell, taste, and touch. Sight and hearing are most important because humans perceive most of their surroundings using these senses. This is especially evident in entertainment and online communication like video and phone calls, where we can only see or hear the other person.
If a computer could have these 2 senses, it could potentially mimic the behavior of a human. This led to the need for and evolution of computer vision and natural language processing.
What is computer vision (CV) and natural language processing (NLP)?
Computer vision explores how computers can gain meaning and understanding from digital media like images and videos.
A subfield of artificial intelligence, natural language processing deals with interactions between computers and humans. The goal of NLP is to give machines an understanding of human language so they can process and respond to queries more effectively.
Machine learning (ML) is instrumental in enhancing computer vision and NLP. Machine learning is an application of AI that gives systems the ability to automatically learn and improve from experience without being explicitly programmed. With machine learning, computer programs can access data and use it to learn by themselves.
This essentially means that, if we have enough data, we can make a computer “learn“ from images, plain text, audio, etc. There’s a lot of math and statistics involved in this. In layman's terms, we are trying to “fit” a line, not just on the available data points, but also on unseen real-world data. To achieve this, we need tons of data. See figure below. The green line represents real data, while the red line represents our predictions.
Here at Zyratalk, we exclusively use NLP as it’s sufficient for our text-based chatbot.
2. How does natural language processing work in webchat?
Since our chatbot only uses NLP and not CV, we’ll focus on NLP from here on out.
Using NLP in automated webchat requires a machine learning model trained on the most common user intents. For this, we need to identify the industries we’re targeting and train the model based on that data.
For example, let’s say we’re targeting the home services industry. We’ll need tens of thousands of user chats in the industry to train our model. Users might ask about AC installation, heater repairs, pipe leaks, etc. All that user chat data has to be labeled properly in order to train the model.
After the model is trained, it’s deployed into production for use in webchat. The chatbot should be able to take user messages as input. This input is passed into the model and a label is predicted with a confidence level. If the confidence is above a certain point, then webchat would take a predefined action to assist the customer. Suppose that it identified the intent as “schedule”. The chatbot may ask follow-up questions, like the user’s name, date and time of the preferred appointment, etc. The chatbot can also direct the customer to the “schedule an appointment” page on your website.
In this way, you can leverage NLP in web chat and “hire” a digital employee that works 24/7. Our development team analyzes chat data to train machine learning models, which means you don’t need any technical experience to use your chat widget. Our industry-specific chat scripts come built into our software, so you can start using it right after installing.
3. How does machine learning work in webchat?
There 3 approaches to ML which are broadly categorized in 3 areas: supervised, unsupervised, and reinforcement learning. We'll only discuss supervised and unsupervised learning, since we don’t use reinforcement learning.
Supervised learning: A “teacher” presents the computer with sample imputs and their desired outputs. The goal is to learn a general rule that maps inputs to outputs.
Unsupervised learning: The learning algorithm is left on its own to find structure in each input. Unsupervised learning can be a goal in itself used to discover hidden patterns within the data, or a means to an end.
For our purposes, the main difference between supervised and unsupervised learning is that we provide the label along with the data in supervised learning, whereas we don’t in unsupervised.
We use unsupervised learning to identify new intents and supervised learning to train our machine learning model. For example, we have tons of user chats in our database that we use to identify new intents and new industries. Our chat data also keeps us updated on common user questions within the industry.
Here’s how it works. In our system, similar text inputs are grouped together. A couple of examples include:
- “Hey I need an AC installation, the old one just doesn’t work anymore.”
- “Do you do A/C installs? Want a 5 ton Goodman unit.”
Then, we analyze the groups and assess what the customers need. If the group has enough examples in it, we will finalize around a specific intent like “AC installs”.
Next comes supervised learning. After we have all the intent groups and their respective examples, we feed them into our model. Our model “learns” from the examples we input. In other words, after inputting enough examples of AC installs, when the bot receives a similar query to our examples, it will identify it as an “AC install”. As more and more data around AC installs is added to the model, future queries that are input into the system will be analyzed with an ever higher confidence score.
We’ve already built a pre-trained model with hundreds of intents and tens of thousands of example queries. Our intuitive, easy-to-use chatbot builder lets you use any of the intents in our system to build a fully customized chatbot suited for your needs.
4. What are some of the components of NLP in simple terms?
Though NLP is a complex problem, we can categorize its components into a couple of broad areas.
Lexical analysis involves analyzing, identifying, and describing the structure of words, as well as dividing text into paragraphs, words, and sentences. This includes handling ambiguous punctuation like “Hi, I’m Mr. Cook.”. The second period marks the end of the full sentence, while the first period marks the end of the clause.
Syntactic interpretation involves finding the correct parse tree showing the phrase structure of the string. Syntax refers to the rules that regulate the sentence structure of individual languages.
Semantic interpretation focuses only on the literal meaning of words, phrases, and sentences. This only extracts the dictionary meaning or the “real” meaning from the given context.
I’m sitting at the river bank.
I’m heading to the bank to deposit money.
Here, even though “bank” has a different meaning in both sentences, the system will assign both of them as the same value for processing.
Pragmatic interpretation considers the effect of the overall context on altering the literal meaning of a sentence after performing semantic analysis. (This requires knowledge retrieval and reasoning.)
Katie has a strong interest in the field of computational linguistics.
Katie pays a large amount of interest on her credit card.
Using pragmatic interpretation, the system will identify “interest” as having different meanings in each example.
5. What does the future hold for NLP and ML in webchat?
As we mentioned, NLP and ML require vast amounts of data to properly mimic human behavior. Here at ZyraTalk, we’re constantly improving our data model and adding new examples and intents every day.
But even vast amounts of data isn’t enough, as human language is essentially infinite. There are more than 250,000 words in the English dictionary. Creating a set of all possible syntactically correct sentences is a tall order. And that’s not even taking into account typos, “urban”/”internet” words, or the fact that humans don’t always write syntactically correct sentences.
NLP and ML technologies are advancing every day, but they still have a long way to go before webchat can entirely replace a live agent. The best strategy to use NLP in webchat is to incorporate common, simple user requests. If things get too complicated, bring in the live chat agent.
Answering your questions about natural language processing: wrapping up
A big thank you to Sagar for taking the time to explain these complex concepts thoroughly and in simple terms. Now that you have a deeper understanding of how automated webchat processes queries, why not build a chatbot of your own? ZyraTalk’s chatbot builder has a less-than-entry-level functionality, which means you don’t have to know a thing about software development to use it!
In the market for webchat software for local business? ZyraTalk’s hybrid solution combines automated and live chat to give you maximum control over your communications with customers. Book your free 15-minute demo today for a behind-the-scenes glimpse of our chat scripts and bot builder.