Natural-language understanding (NLU) is a subtopic of natural-language processing in artificial intelligence that deals with machine reading comprehension.
Dasha platofrm provides meanings of using our NLU via NLU API and via the DSL API for NLU control.
The both ways have the same abilities and are samely configured. But while the DSL is used in Dasha applications, the NLU API can be used independently.
There are two main NLU terms you should know: entities and intents (see the nlu doc, intents demo and entitites demo to learn them).
The intents and entities are grouped in skills. A skills contains intents and entities of some particular language (for now only Russian and English languages are available).
Generally, you have two options of using our NLU:
- using the existing pretrained skills (system intents)
- using the custom skills that are obtained from custom datasets
The custom dataset defines the training samples for your own entities and intents. You can see our NLU demos to learn more!
The current example observes the use of NLU API with custom datasets and with our pretrained skills.
The NLU API provides NluService class for creating the instance of NLU service. All called methods of an instance trigger our core NLU service via GRPC.
The list of methods:
- create - create an instance of NLU service asynchronously
- train - train (for the first time) or load (if dataset was already used for training) several custom skills from your datasets (in this example they are stored in
dataset-en.js
anddataset-ru.json
files) - loadSkills for loading list of pretrained skills (they became connected to current instance). In this example the following skills are used:
{ id: "sentiment", language: "ru-RU" }
{ id: "date-and-time", language: "ru-RU" }
- recognize for making recognition request to our server with pretrained and custom skills that are connected to current instance. It only takes the
text
parameter
You can explore the index.js
file to see the use of several custom and pretrained skills.
- Setup environment (see doc)
- Run
npm i
in the current folder.
Run npm start
to execute script index.js
.