Skip to main content
Skip table of contents

Natural Language Understanding - C++

VDK features only one Natural Language Understanding library: VNLU (Vivoka).

VNLU is the name of the Natural Language Understanding engine created by Vivoka. It is integrated in the VSDK framework under the designation VSDK-VNLU. It is designed to work with an ASR engine.

Supported Languages

Currently 5 languages are supported:

  • 🇫🇷 fra-FR → French of France

  • 🇺🇸 eng-US → Enlish of United States

  • 🇮🇹 ita-IT → Italian from Italy

  • 🇪🇸 spa-ES → Spanish from Spain

  • 🇩🇪 deu-DE → German from Germany

Supported Features

Here is a list of all supported features by this engine:

Feature name

Description

Intent extraction

Ability to extract the intention of a sentence

Entities extraction

Ability to extract zero or more entities from a sentence

Specialized to a custom domain

Fine-tuned on customer domain

Engine Configuration

Like any other engine in VSDK, this one also have its own configuration that needs to be provided as a JSON file when instantiating the engine.

Here is a sample of the configuration:

JSON
{
  "version": "2.0",
  "vnlu": {
    "paths": {
      "data_root": "../data"
    },  
    "nlu": {
      "parsers": {
        "p1": {
          "model": "my-custom-model.vum"
        }
      }  
    }   
  }
}

This configuration represents the minimum required in order to operate the engine.

Required Resources

As seen in the configuration file above, only 1 resource file is required in order to run the engine and it is the .vum (Vivoka Understanding Model) file.

Sample Code

CPP
#include <vsdk/Exception.hpp>
#include <vsdk-nlu/nlu/vnlu/Engine.hpp>
#include <vsdk-nlu/nlu/vnlu/Parser.hpp>
 
std::string getMoreText();
 
int main(int argc, char * argv) try
{
    auto engine = Vsdk::Nlu::Engine::make<Vsdk::Nlu::Vnlu::Engine>("vsdk.json");
    auto parser = engine->parser("p1");
 
    parser->subscribe([](Vsdk::Nlu::Vnlu::Parser::Result const & result)
    {
        fmt::print("Result: {}\n", result.json.dump(4));
    });
 
    parser->process(getMoreText());
 
    return EXIT_SUCCESS;
}
catch (std::exception & const e)
{
    fmt::print(stderr, "A fatal error occured:\n");
    Vsdk::printExceptionStack(e);
    return EXIT_FAILURE;
}

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.