Search for answers or browse our knowledge base.
Natural Language Tutorial
Introduction
This tutorial shows the developer how to add to the core Vantiq natural language processing capabilities.
Natural language processing enables customers to interact with Vantiq applications using language with which they are familiar, rather than having to learn the language of the application.
The Vantiq system provides a set of capabilities for interacting with the Vantiq system itself, and is extensible so that application developers can add language appropriate to their application and/or user base.
In this tutorial, we will learn how to add natural language processing to a Vantiq application, and how to extend the base system to include language specific to the application.
Our approach in this tutorial is to move forward by incrementally building a working system.
We will first add the Vantiq-supplied natural language base,
then add the extensions specific to this application.
Throughout this tutorial, we demonstrate the working system by interacting with Vantiq using Slack.
Any client that can interoperate with a Vantiq chatbot source is fine;
here, we have chosen to use Slack.
The application in this tutorial is a simple hospital application.
This application will allow hospital staff to query the Vantiq system for patients based on condition and/or location.
This tutorial imagines a hospital application where patients are admitted and their various test results cataloged.
The natural language system is added to allow queries based on that patients’ conditions:
- hypertension
- tachycardia (high heart rate)
- diabetes mellitus
and their current location (room) in the hospital
- emergency room
- admissions
- intensive care unit
- room number
Thus, rather than use query-like language to find this information (e.g. list patients where glucose > 100),
the application user will be able to use a more (medical) people literate form (e.g. who’s in ER with diabetes).
All lessons assume the developer has a working knowledge of the Vantiq IDE. It is recommended that a new developer completes the lessons in the Introductory Tutorial before starting the lessons in this tutorial.
In addition, please see the Natural Language Guide for more information about the Vantiq natural language processing system.
Overview
The overall structure of the Vantiq natural language system is depicted in the following diagram.
Architecturally, the Conversational Language Understanding (CLU) application is responsible for interpreting these utterances, analyzing them, and returning the appropriate intent and associated entities.
The Vantiq application is responsible for understanding these intents and entities, and executing them to provide the user with the appropriate response.
In this tutorial, we will make use of the chatbot, a compatible chat client, and the CLU application.
We will perform the following actions.
- Create a CLU Application
- Create a Vantiq Procedure to execute intents
- Create a Vantiq Rule to receive utterances, orchestrate their interpretation, and execute the intents
- Extend our CLU application with some hospital specific utterances
- Extend our Vantiq application to process these utterances
We will start with the CLU application.
Set Up the Converstational Language Understanding Application
In the subsequent sections, we will walk through the steps to create and modify our CLU application.
Please see the Conversational Language Understanding documententation for a more detailed explanation and walk through.
Create A Cognitive Services Account
CLU applications run in Microsoft’s Azure cloud, and are part of a wider offering known as Cognitive Services.
Information about setting up accounts and creating a service can be found at the Conversational Language Understanding home.
Before proceeding, we will need to have an account set up for our CLU application.
Create the account and Azure Language resource now.
Import the Vantiq Natural Language Subset
Once the account is set up, we will be able to log in and find the list of projects page.
(In this case, this is a new account.
If we have already imported or created other applications,
some applications may be listed here.)
The next step is to import the Vantiq natural language subset (for details, see the Natural Language Guide).
The Vantiq natural language subset contains various intents and entities that allow for simple queries against the Vantiq system.
These include things like
- Generic Queries
- list projects
- list people whose name is fred (where “people* is a type defined in Vantiq)
- describe people
- Vantiq Specific language
- show active collaborations since the eighth of September
- “Smalltalk”
- howdy
- Thanks
A zip file containing the Vantiq NLS can be found here.
Please download and unzip this this file, keeping track of its location.
Once downloaded and unzipped, return to the *My Apps page depicted above.
Press the Import
button, which will bring up an import dialog.
Press the Choose File
button, and select the VantiqBase_CLU.json
from the file you downloaded and unzipped. Add a project name to the import dialog – here, we’ve used VantiqNatLangTutorial. (If no name is provided, it will default to VantiqBase.)
Once complete, this will place us on the Schema Definition screen of that project.
Here, we see the new CLU application VantiqNatLangTutorial intents and entities used. Click on Training Jobs.
Train and Deploy
Our next step is to make the core Vantiq capabilities available without alteration.
To do this, we need to train and deploy our CLU application.
So far, we have imported the natural language subset that can understand some commands about the Vantiq system.
However, to make this available, we must train the application and publish it.
Training Your CLU Application
Training is a step where the definition of the natural language subset is processed by the CLU system,
and the resulting training data made ready to publish.
The natural language subset contains a set of entities, intents, and utterances. (These are oulined in the CLU documentation and in the Vantiq Natural Language Guide.)
The training process maps the utterances to intents and entities so that similar utterances presented by CLU application users can be transformed into the appropriate intents and entities.
To train the CLU application, we press the Start a training job
button from our project’s Training Jobs page. Here, we’ll need to define the model name to be trained. You will use this name later to invoke your CLU application. We have used VantiqTutorialModel as our model name.
Start the job, and we see the list of recent training jobs. Since this is our first, there is only one such job.
When this is done, we will see informational message(s) near the top of the browser window that provide our status.
Deploying our CLU Application
To provide access, we will deploy the application using the trained model we have just created. Press the Deploying a model item, then the Add deployment button. This will present us with the following choices.
Here, we selected a name for our deployment, VantiqTutorialDeployment (this, too, will be used to access our application), and the model we’ve just trained. Now press the Deploy
button.
Once complete, we will see our list of deployments.
Testing the CLU Application
To test our CLU application, we select the Testing deployments
item. From that, we select our deployment and enter some text.