SkillAgentSearch skills...

NLU

The GeniSys NLU Engine includes a combination of a custom trained DNN (Deep Learning Neural Network) built using TFLearn for intent classification, and a custom trained MITIE model for entity classification.

Install / Use

/learn @GeniSysAI/NLU

README

GeniSys NLU Engine

GeniSys NLU Engine

CURRENT RELEASE UPCOMING RELEASE

About GeniSys AI

GeniSys AI is an open source Artificial Intelligence Assistant Network using Computer Vision, Natural Linguistics and the Internet of Things. GeniSys uses a system based on TASS A.I for vision, an NLU engine for natural language understanding, in browser speech synthesis and speech recognition for speech and hearing, all homed on a dedicated Linux server in your home and managed via a secure UI.

About GeniSys NLU Engine

I orginally developed what is now the GeniSys NLU Engine back in 2017 (How I built a fully functional Deep Learning Neural Network chatbot platform (NLU Engine) in under a week....). The project was originally developed to be used in some commercial AI projects I had built, after I closed the business down it became a personal project for my home and as I have open sourced most of my other projects, it made sense to open source this one.

The NLU Engine includes a combination of a custom trained DNN (Deep Learning Neural Network) built using TFLearn for intent classification, and a custom trained MITIE model for entity classification. The engine can can handle not only named entities, but synonyms also and both features are used by the core training module.

What Will We Do?

This tutorial will help you setup the NLU Engine required for your GeniSys network, and also takes you through setting up iotJumpWay devices. In detail this guide will cover the following:

  • Installing and setting up required software
  • Creating your intent and entity training data
  • Training your intent and entity classifiers
  • Testing your classifier locally in real time
  • Testing your classifier API via a client

Example Output

The following is an unedited conversation within the basic capabilities provided by the example training data (The full response print out has been removed to make it easy to follow the conversation):

>Hi
2018-09-30 22:58:37|Human|Intent: Hi
2018-09-30 22:58:37|GeniSys|Reponse: Hello human, please tell me your GeniSys user

>It is Adam of course!
2018-09-30 22:58:44|Human|Intent: It is Adam of course!
2018-09-30 22:58:44|GeniSys|Reponse: Hello Adam, what can I do for you?

>If I was your friend, what would I call you?
2018-09-30 22:58:54|Human|Intent: If I was your friend, what would I call you?
2018-09-30 22:58:54|GeniSys|Reponse: Call me Geni

>Ok but what is your real name?
2018-09-30 22:59:01|Human|Intent: Ok but what is your real name?
2018-09-30 22:59:01|GeniSys|Reponse: My name is GeniSys

>Ok thanks
2018-09-30 22:59:10|Human|Intent: Ok thanks
2018-09-30 22:59:10|GeniSys|Reponse: Any time!

>Please tell me, what is my name?
2018-09-30 22:59:22|Human|Intent: Please tell me, what is my name?
2018-09-30 22:59:22|GeniSys|Reponse: Your name is Adam, how can I help you?

>I don't suppose you know what time it is?
2018-09-30 22:59:32|Human|Intent: I don't suppose you know what time it is?
2018-09-30 22:59:32|GeniSys|Reponse: The time is Sun Sep 30 22:59:32 2018

>Ah cool thanks
2018-09-30 22:59:37|Human|Intent: Ah cool thanks
2018-09-30 22:59:37|GeniSys|Reponse: My pleasure

In the conversation above, when I asked the time, the extension attached to the related intent in the training data is triggered, basically an extension is the path to a function in one of your custom classes, you can find out more about this later in the tutorial. Although hardly any of the things I said were entirely provided in the training data, the AI was capable of identifying my intent.

Operating System

  • Tested on Ubuntu 18.04.1 LTS (Bionic Beaver), previous versions have been tested in Windows successfully but you need to make sure you install MITIE correctly on your Windows machine.

Python Versions

  • Tested with Python 3.5

Software Requirements

Hardware Requirements

  • 1 x Desktop device or laptop for development and training, prefereably with an NVIDIA GPU

Installation & Setup

The following guides will give you the basics of setting up a GeniSys NLU Engine.

Prerequisites

You must of already completed the setup following project:

The following guides will give you the basics of setting up a GeniSys NLU Engine.

Clone The GeniSys NLU Engine Repo

First you need to clone the NLU Engine repo to the machine you will be running it on. To do so, navigate to the directory you want to place it in terminal and execute the following command:

 $ git clone https://github.com/GeniSysAI/NLU.git

Once you have done this, you have all the code you need on your machine.

Install The Required Software

Now you need to install the required software, I have provided a requirements file that will contain all required modules for the project. You can use it to install the modules using the following command:

 $ sh setup.sh 

The command execute the setup shell file which will istall the required software for the project including NTLK, TFLearn, MITIE and iotJumpWay.

Set Up iotJumpWay

Now you need to setup some an iotJumpWay device that will represent your NLU Engine on the Internet of Things. The following part of the tutorial will guide you through the process.

iotJumpWay

First of all you should register your free iotJumpWay account, all services provided by the iotJumpWay are also entirely free within fair limits. Once you have registered you need to:

Once you have set up your iotJumpWay device, you should update the configuration file with your iotJumpWay credentials.

Training Data

Now it is time to think about training data. In the data/training.json file I have provided some starter data, it is not a lot but enough to have a good test and show the example further on in the tutorial.

Extensions

Extensions are external Python classes that you can use to extend the functionality used to generate a response. Extensions should be stored in the extensions directory. Below is an example configuration that is used to execute the gTime -> getTime function. Defined responses with placeholders specified by %%, once the function is ready it will return a modified response replacing %%TIME%% with the actual time. This response will override any response previously selected. For a more detailed extension, check out gHumans which uses MySql to manage the users GeniSys interacts with.

"extension":  {
    "function": "extensions.gTime.getTime",
    "entities": false,
    "responses": [
        "The time is %%TIME%%",
        "Right now it is %%TIME%%",
        "It is around %%TIME%%"
    ]
}

Training Your NLU Engine

Training Your NLU Engine

Now everything is set up, it is time to train. The main functionality for the training process can be found in Train.py, tools/Data.py, tools/Model.py and tools/Mitie.py, the configuration for training can be found and modified in required/confs.json. If you have modified your training data, you may need to update your configuration from time to time.

To begi

View on GitHub
GitHub Stars39
CategoryEducation
Updated1y ago
Forks9

Languages

Python

Security Score

80/100

Audited on Jan 12, 2025

No findings