Skip to main content
Skip table of contents

Natural Language Understanding - Android

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 → English of United States

  • 🇮🇹 ita-IT → Italian from Italy

  • 🇪🇸 spa-SP → 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

JAVA
private void initEngine() {
    final Context mContext = this;
    final String assetsPath = getFilesDir().getAbsolutePath() + "/vsdk/";
    try {
        // VSDK Engine
        Vsdk.init(mContext, "config/vsdk.json", success -> {
            if (success) {
                try {
                    Engine.getInstance().init(mContext, success1 -> {
                        if (success1) {
                            Log.e(_TAG, "Engine got created !! ");
                            createParser();
                        } else {
                            Log.e(_TAG, "Cannot initialize the ASR engine");
                        }
                    });
                } catch (Exception e) {
                    Log.e(_TAG, e.getFormattedMessage());//                            e.printStackTrace();
                }

            } else {
                Log.e(_TAG, "Cannot initialize the VSDK engine");
            }
        });
    } catch (Exception e) {
        e.printFormattedMessage();
    }
}

private void createParser() {
    try {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
        _parser = Engine.getInstance().getParser("p1", new IParserListener() {
            @Override
            public void onResult(String res) {
                Log.e(_TAG, "Res: " + res);
                Result nluResult = new Result(res);
                Intent intent = nluResult.getIntent();
                ArrayList<Entity> entities = nluResult.getEntities();

                Log.e(_TAG, String.format("Found res with lang '%s' for orig sentence '%s'",
                        nluResult.getLang(), nluResult.getOriginalSentence()));
                Log.e(_TAG, String.format("Found intent '%s' with confidence '%f'",
                        intent.getName(), intent.getConfiddence()));
                for (Entity entity : entities) {
                    Log.e(_TAG, String.format("Found entity '%s' with value '%s'",
                            entity.getName(), entity.getValue()));
                }
            }

            @Override
            public void onError(String error) {
                Log.e(_TAG, "ERROR: " + error);
            }
        });
    } catch (Exception e) {
        e.printFormattedMessage();
    }
}

JavaScript errors detected

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

If this problem persists, please contact our support.